From b5249acbd19deb27515ad92eb3a6cb08811eb8d3 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 8 Oct 2026 03:23:09 +0000 Subject: [PATCH] ci: wait for image validate using PR head SHA gh run list keys off the branch head commit, not the merge ref GITHUB_SHA used in workflow_call Playwright jobs. Co-authored-by: cynarAI --- .github/workflows/playwright.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) 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."