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 <cynarAI@users.noreply.github.com>
This commit is contained in:
parent
f2613a9a90
commit
b5249acbd1
21
.github/workflows/playwright.yml
vendored
21
.github/workflows/playwright.yml
vendored
@ -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')"
|
||||
--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 this commit; continuing."
|
||||
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."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user