From 3b85a2f4d734c02f81439c774dfe69ea018c2998 Mon Sep 17 00:00:00 2001 From: laurenhitchon Date: Wed, 29 Jul 2026 21:56:45 +1000 Subject: [PATCH] fix(ci): exclude the promote job's own check runs from promotion validation --- .github/workflows/promote-v1.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/promote-v1.yml b/.github/workflows/promote-v1.yml index 89c13bd..940aca8 100644 --- a/.github/workflows/promote-v1.yml +++ b/.github/workflows/promote-v1.yml @@ -56,7 +56,13 @@ jobs: echo "::error::${sha} is not on main — v1 only ever points at main history" exit 1 fi - checks="$(gh api "repos/${GITHUB_REPOSITORY}/commits/${sha}/check-runs?per_page=100" --jq '.check_runs')" + # Exclude this workflow's own check runs (jq: .name != "promote"): + # when the target is the current main head, this very job attaches + # to it as an in-progress check — counting itself as "pending" would + # make promotion structurally impossible, and an earlier failed + # attempt would poison the commit red forever. If the promote job + # is ever renamed, update the filter to match. + checks="$(gh api "repos/${GITHUB_REPOSITORY}/commits/${sha}/check-runs?per_page=100" --jq '[.check_runs[] | select(.name != "promote")]')" bad="$(jq '[.[] | select(.conclusion as $c | ["failure", "cancelled", "timed_out", "action_required"] | index($c))] | length' <<<"$checks")" pending="$(jq '[.[] | select(.status != "completed")] | length' <<<"$checks")" ok="$(jq '[.[] | select(.conclusion == "success")] | length' <<<"$checks")"