Skip to content

Commit 7ac37e0

Browse files
committed
docs(designs): add merge_group trigger to semver-gate workflow
Per review on PR #9057: the workflow as proposed only declared on.pull_request, but this repo uses GitHub's merge queue (see build.yml's existing merge_group trigger). When a PR enters the queue, GitHub dispatches a merge_group event against an ephemeral ref, not pull_request. A required check that only listens on pull_request never reports a status on the merge_group event, so the merge queue treats it as missing/pending and blocks the merge — the same skipped-but-required failure mode the path-filter pitfall was about, just under a different trigger. Mirror build.yml: listen on both pull_request and merge_group with the same branch filters. The check_semver_bump.py script's self-gating (exit 0 when no expected.*.yaml changed) only helps when the workflow runs at all; this fix makes it run. Add a "resolve base ref" step because the two event types expose the target branch differently: pull_request sets github.base_ref to the bare branch name; merge_group leaves base_ref empty and exposes the full ref at github.event.merge_group.base_ref (e.g. "refs/heads/develop"), which we strip to match the pull_request shape before passing to check_semver_bump.py. Document both flavors of the pitfall (path-filter and single-trigger) in the design's "skipped but required" callout so future maintainers see why we chose this trigger configuration.
1 parent fd5e38c commit 7ac37e0

1 file changed

Lines changed: 31 additions & 11 deletions

File tree

designs/golden_templates_and_semver_check.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -334,24 +334,44 @@ can never diverge.
334334
### The semver gate
335335

336336
Tiny standalone GitHub workflow at
337-
`.github/workflows/golden-semver-gate.yml`. Runs on every PR; the script
338-
itself returns exit 0 when no corpus pins changed, so it's cheap to run
339-
unconditionally and posts a definitive status on every PR (which lets
340-
branch protection mark it as a required check without blocking
341-
unrelated PRs):
337+
`.github/workflows/golden-semver-gate.yml`. Runs on every PR *and* on
338+
every merge_group event; the script itself returns exit 0 when no
339+
corpus pins changed, so it's cheap to run unconditionally and posts a
340+
definitive status on every event (which lets branch protection mark
341+
it as a required check without blocking unrelated PRs or merge-queue
342+
runs):
342343

343344
```yaml
344345
on:
345346
pull_request:
346347
branches: [develop, "feat/*", "feat-*"]
348+
merge_group:
349+
types: [checks_requested]
350+
branches: [develop, "feat/*", "feat-*"]
347351
```
348352

349-
The workflow does *not* use `on.pull_request.paths:` filtering. Path
350-
filtering at the trigger level skips the workflow entirely on PRs that
351-
touch no matching path — no status posts, and a required check that
352-
never reports gets treated by branch protection as missing/pending.
353-
Self-gating in the script (return 0 when there are no relevant changes)
354-
is the simpler fix and keeps the check eligible to be required.
353+
The workflow avoids two flavors of the "skipped but required check"
354+
pitfall:
355+
356+
1. **No `on.pull_request.paths:` filtering.** Path filtering at the
357+
trigger level skips the workflow entirely on PRs that touch no
358+
matching path — no status posts, and a required check that never
359+
reports gets treated by branch protection as missing/pending.
360+
Self-gating in the script (return 0 when there are no relevant
361+
changes) is the simpler fix and keeps the check eligible to be
362+
required.
363+
364+
2. **Both `pull_request` and `merge_group` triggers.** The repo uses
365+
GitHub's merge queue; when a PR enters the queue, GitHub
366+
dispatches a `merge_group` event against an ephemeral ref, not
367+
`pull_request`. A required check that only listens on
368+
`pull_request` never reports a status on the `merge_group` event,
369+
so the merge queue treats it as missing/pending — the same failure
370+
mode under a different trigger. Mirror `build.yml`'s pattern by
371+
listening on both events with the same branch filters. The
372+
workflow then resolves the target branch from `github.base_ref` on
373+
PR events and from `github.event.merge_group.base_ref` (stripping
374+
the `refs/heads/` prefix) on merge-queue events.
355375

356376
`check_semver_bump.py` rules:
357377

0 commit comments

Comments
 (0)