ci: run required checks on merge_group events#586
Conversation
The `main.yml` workflow only triggered on `pull_request` and `push`, so none of its jobs ran for merge-queue (`merge_group`) commits. The required contexts it produces -- `required-checks`, `codecov/patch`, and `codecov/project` -- were therefore never reported on the merge-group ref, leaving the merge queue stuck waiting until it timed out and dequeued the PR (observed on #583). `license/cla` already reports on merge groups. Changes: - Add the `merge_group` trigger to `main.yml`. - Extend the `pull_request` job gates (semver, extended-analysis, model-checking, fuzz-testing, mutation-testing) to also run on `merge_group`. - `delta`: compute a scoped impact for merge groups too (baseline = `merge_group.base_sha`) so PR and queue runs behave identically; the post-merge `push: main` run remains the full backstop. - `semver`: fall back to `merge_group.base_ref` (stripping `refs/heads/`) since `github.base_ref` is empty on merge groups. - `pr-title` stays PR-only: the semantic-PR-title action has no PR to read in a merge group, so it skips and `required-checks` treats skip as success. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2911ce9c-e404-430f-9587-6c567157b1f3
There was a problem hiding this comment.
Pull request overview
This PR updates the primary CI workflow to run on GitHub merge queue (merge_group) refs so that required status contexts are reported for merge-group commits, preventing merge-queue stalls.
Changes:
- Add
merge_groupas a trigger for.github/workflows/main.yml. - Extend PR-scoped job gates (e.g.,
semver,extended-analysis,model-checking,fuzz-testing,mutation-testing) to also run onmerge_group. - Update
deltaandsemverbaseline selection logic to work correctly whengithub.base_refis empty on merge-group events.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # For `pull_request` this is the target branch (e.g. `main`); for | ||
| # `merge_group` `github.base_ref` is empty, so fall back to the merge | ||
| # group's base ref (`refs/heads/main`) and strip the prefix below. | ||
| BASE_REF: ${{ github.base_ref || github.event.merge_group.base_ref }} |
There was a problem hiding this comment.
Addressed in 46055d3. Added an explicit github.event_name == 'pull_request' guard to the Post Semver Comment step. (Actions expression eval returns null rather than erroring on null.head.repo..., so the step already skipped on merge groups, but the explicit gate is clearer and more robust.)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #586 +/- ##
=======================================
Coverage 100.0% 100.0%
=======================================
Files 359 359
Lines 27885 27885
=======================================
Hits 27885 27885 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Make the merge-group skip explicit: `github.event.pull_request` is null on merge groups, so gate the sticky-comment step on `github.event_name == 'pull_request'` for clarity and robustness rather than relying on null property access evaluating falsey. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2911ce9c-e404-430f-9587-6c567157b1f3
Problem
Enabling the merge queue left PRs stuck in the queue until they timed out and were dequeued (observed on #583).
.github/workflows/main.ymlonly triggered onpull_requestandpush, so none of its jobs ran for merge-queue (merge_group) commits. The three required contexts it produces were therefore never reported on the merge-group ref:required-checkscodecov/patchcodecov/projectBranch protection requires all three, so the queue waited indefinitely. Verified against the merge-group commit for #583 (
a4b4be3c): onlyanvil-pr(which already had themerge_grouptrigger),GitOps/GitHubPop, andlicense/clareported — the threemain.ymlcontexts were absent.license/claalready reports on merge groups, so it is unaffected.Changes
merge_grouptrigger tomain.yml.pull_requestjob gates (semver,extended-analysis,model-checking,fuzz-testing,mutation-testing) to also run onmerge_group.delta: compute a scoped impact for merge groups too (baseline =merge_group.base_sha, already in history viafetch-depth: 0) so PR and queue runs behave identically. The post-mergepush: mainrun remains the full backstop.semver: fall back tomerge_group.base_ref(strippingrefs/heads/) sincegithub.base_refis empty on merge groups.pr-titlestays PR-only: the semantic-PR-title action has no PR to read in a merge group, so it skips and therequired-checksfan-in treats skip as success.Notes
The
required-checksfan-in (if: always(), passes when every dependency succeeded or skipped) means PR-only jobs that skip on merge groups don't block the queue.