diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index bbdd5db..e961abd 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -67,18 +67,29 @@ jobs: if: github.event_name == 'pull_request' || github.event_name == 'workflow_call' env: GH_TOKEN: ${{ github.token }} + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: | set -euo pipefail - sha="${GITHUB_SHA}" - echo "Waiting for publish-server-image on ${sha} before starting Vite…" - for attempt in $(seq 1 120); do + shas=("${GITHUB_SHA}") + if [[ -n "${PR_HEAD_SHA}" ]]; then + shas+=("${PR_HEAD_SHA}") + fi + run_id="" + for sha in "${shas[@]}"; do run_id="$(gh run list --repo "${GITHUB_REPOSITORY}" --commit "${sha}" \ --workflow publish-server-image.yml --limit 1 \ - --json databaseId,status -q '.[0].databaseId // empty')" - if [[ -z "${run_id}" ]]; then - echo "No publish-server-image run for this commit; continuing." - exit 0 + --json databaseId -q '.[0].databaseId // empty')" + if [[ -n "${run_id}" ]]; then + echo "Found publish-server-image run ${run_id} for commit ${sha}." + break fi + done + if [[ -z "${run_id}" ]]; then + echo "No publish-server-image run for ${shas[*]}; continuing." + exit 0 + fi + echo "Waiting for publish-server-image before starting Vite…" + for attempt in $(seq 1 120); do status="$(gh run view "${run_id}" --repo "${GITHUB_REPOSITORY}" --json status -q .status)" if [[ "${status}" == "completed" ]]; then echo "publish-server-image run ${run_id} completed."