From dde813516ab41611a99d2556c36a75c3b0c7d4f3 Mon Sep 17 00:00:00 2001 From: Fadion Dashi Date: Fri, 28 Aug 2026 00:00:06 +0200 Subject: [PATCH] ci: one check for branch protection to require Requiring the seven job names deadlocked the first documentation-only pull request, and not for the reason #69 anticipated. Skipping works: lint, language and fuzz all reported "skipping" on #71, which is a conclusion and satisfies a required check. But a skipped MATRIX job reports its name unexpanded -- literally "test (${{ matrix.os }})" rather than the three real ones -- so "test (ubuntu-latest)" and its two siblings never arrived at all, and the pull request sat BLOCKED on checks that cannot exist. Exactly the deadlock #69 set out to prevent, one level down. Requiring individual job names has a second problem worth fixing while here: every required name is coupled to a job name, so renaming a job silently stops protection enforcing it, with nothing anywhere to notice. So: a `ci` job that always runs, gates on the other five, and fails if any of them failed or was cancelled. Skipped is fine, since that is the filtering working as intended. It always reports because it always runs, whatever the jobs beneath it did. Branch protection should require this one check and nothing else. Adding a job later then needs no change to the ruleset, and renaming one cannot quietly disable it. The comparison pads both sides -- `case " $RESULTS " in *" failure "*` -- so a status that merely contains another as a substring cannot match by accident. Checked against all-success, all-skipped, a failure, a cancellation, and a failure among skips. Co-Authored-By: Claude Opus 5 --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57ea1d2..09b3238 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -219,3 +219,35 @@ jobs: name: fuzz-corpus path: internal/*/testdata/fuzz/ if-no-files-found: ignore + + # One check for branch protection to require, instead of seven. + # + # Requiring the job names directly has two problems. A skipped matrix job + # reports its name unexpanded -- literally "test (${{ matrix.os }})" rather + # than the three real ones -- so a required "test (ubuntu-latest)" waits + # forever on a documentation change, which is the deadlock the job-level + # filtering was meant to avoid in the first place. And every required name is + # coupled to a job name: rename a job, and protection silently stops enforcing + # it with nothing anywhere to notice. + # + # This job always runs, so it always reports, and it fails if anything it + # gates on failed or was cancelled. Skipped is fine: that is the filtering + # working. Require this and nothing else. + ci: + name: ci + if: always() + needs: [changes, test, lint, language, fuzz] + runs-on: ubuntu-latest + steps: + - name: Check what the other jobs did + env: + RESULTS: ${{ join(needs.*.result, ' ') }} + run: | + echo "results: $RESULTS" + case " $RESULTS " in + *" failure "*|*" cancelled "*) + echo "::error::a job this gates on did not pass" + exit 1 + ;; + esac + echo "all clear"