Fix skip-if-superseded: use curl instead of gh CLI (#6127)

The gh CLI isn't installed on all self-hosted runners. Replace with
curl + python3 which are available everywhere.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 13:31:35 -08:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 2021ee2ae8
commit 5dfd9a7515
+3 -2
View File
@@ -58,8 +58,9 @@ jobs:
run: |
# Check if there's a newer run of this workflow waiting in the queue.
# If so, skip this build — the queued run will deploy a newer commit.
QUEUED=$(gh api "repos/${{ github.repository }}/actions/workflows/docker_build.yml/runs?status=queued" \
--jq "[.workflow_runs[] | select(.run_number > ${{ github.run_number }})] | length")
QUEUED=$(curl -s -H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/docker_build.yml/runs?status=queued" \
| python3 -c "import sys,json; runs=json.load(sys.stdin).get('workflow_runs',[]); print(len([r for r in runs if r['run_number'] > ${{ github.run_number }}]))")
if [ "$QUEUED" -gt 0 ]; then
echo "::notice::Skipping build — $QUEUED newer run(s) queued for this workflow"
echo "skip=true" >> $GITHUB_OUTPUT