#!/usr/bin/env bash # `just look` on the runner, for an agent with no checkout: the look # workflow runs this, at the branch it is asked for, with LOOK as the # arguments look.mjs takes, quoted as a shell would quote them: # # LOOK="profile --phone --set 'getProfile.links=[]'" bash harness/shots/look.sh # # Each picture is left in $KNOTLESS_RUN_OUTPUTS, named for the page and # project, as WebP small enough to keep (shots/outputs.mjs), or as the PNG # should that fail. What look.mjs says, as a page wider than the screen, # is in the log. It fails as look.mjs does, after keeping the pictures. set -euo pipefail cd "$(dirname "$0")/../.." source harness/shots/node.sh # LOOK's words, as a shell splits them, quotes and all. eval "set -- ${LOOK:?LOOK names the pages and options, as just look takes them}" status=0 node harness/shots/look.mjs "$@" || status=$? if [ -n "${KNOTLESS_RUN_OUTPUTS:-}" ]; then for png in target/look/*.png; do [ -f "$png" ] || continue out="$KNOTLESS_RUN_OUTPUTS/$(basename "$png" .png)" node harness/shots/outputs.mjs "$png" "$out" after && continue echo "==> $(basename "$png"): kept as PNG, being no WebP" cp "$png" "$out.png" done fi exit $status