Skip to content

Commit 296ea31

Browse files
eaitbrahimclaude
andcommitted
ci: gate merges on the test check, and verify the merge result
`pull_request` is restored because it is what makes this job report a status named `test` on a PR, and the `main` ruleset now REQUIRES that context before a merge is allowed (#236). The trigger and the ruleset are a matched pair. So the two automatic triggers do different jobs: `pull_request` GATES the merge, `push: [main]` VERIFIES the tree that resulted from it. The second is not redundant -- two independently-green branches can conflict semantically, and only the post-merge run observes that. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 0ed4dc0 commit 296ea31

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,32 @@ name: CI
99
# differ whenever two independently-green branches conflict semantically -- each passes alone, the
1010
# merge of them does not. Only the post-merge run can see that.
1111
#
12-
# What this does NOT do, stated plainly so nobody mistakes it for a gate: it runs AFTER the merge.
13-
# It cannot block one. A broken PR still reaches `main`; this workflow's job is to make sure
14-
# nobody has to wonder for long, not to prevent it. Blocking a merge needs two things this repo
15-
# does not currently have -- a `pull_request` trigger, and a repository ruleset that actually
16-
# matches `main` and requires the `test` context. The ruleset named `main` exists but matches no
17-
# refs (`ref_name.include` is empty; `GET /repos/:owner/:repo/rules/branches/main` returns `[]`),
18-
# and its two required contexts ("Lint, Unit tests, Build", "Integration Tests") match no job this
19-
# repo defines. Both halves have to be fixed together: pointing that ruleset at `main` while its
20-
# contexts still name jobs that never report would block every PR forever.
12+
# `pull_request` is here for a specific, load-bearing reason: it is what makes this job report a
13+
# status named `test` on a PR, and the `main` ruleset REQUIRES that context before a merge is
14+
# allowed (issue #236). The two are a matched pair and must be changed together -- removing this
15+
# trigger while the ruleset still requires `test` would leave every PR waiting forever on a check
16+
# that can never report, which is precisely the broken state #236 was filed to fix. That is not a
17+
# hypothetical: the ruleset previously required "Lint, Unit tests, Build" and "Integration Tests",
18+
# names no job here has ever produced.
2119
#
22-
# `release.yml` remains the gate that matters for money: it re-runs `ruff` + `pytest` itself before
23-
# it will build an artifact, so a red `main` cannot become a wheel, a tag, or a release asset.
24-
# This workflow shortens the time to discovery; that one prevents the consequence.
20+
# The context string is `test` because the job below is `test:` and declares no `name:`. Renaming
21+
# that job, or giving it a `name:`, silently changes the context and breaks the ruleset the same
22+
# way. If you rename it, update the ruleset in the same change.
23+
#
24+
# So the two triggers do different jobs: `pull_request` GATES the merge, `push` VERIFIES the result
25+
# of it. `release.yml` remains the gate that matters for money -- it re-runs `ruff` + `pytest`
26+
# itself before it will build an artifact, so a red `main` cannot become a wheel, a tag, or a
27+
# release asset even if both of these were removed.
2528
on:
29+
pull_request:
2630
push:
2731
branches: [main]
2832
workflow_dispatch:
2933

30-
# `github.ref` is `refs/heads/main` for the push runs and `refs/heads/<branch>` for a dispatch, so
31-
# the group keys on the branch either way. Back-to-back merges to `main` therefore cancel the
32-
# older run -- which is correct here: the newest `main` is the only one whose result still matters.
34+
# `github.ref` is `refs/pull/<n>/merge` for PR runs, `refs/heads/main` for the post-merge push, and
35+
# `refs/heads/<branch>` for a dispatch -- distinct keys, so a PR run never cancels the post-merge
36+
# run. Pushes to the same PR do cancel each other, and back-to-back merges cancel the older `main`
37+
# run -- correct in both cases: only the newest result matters.
3338
concurrency:
3439
group: ci-${{ github.ref }}
3540
cancel-in-progress: true

0 commit comments

Comments
 (0)