Skip to content

ci: run required checks on merge_group events#586

Open
martin-kolinek wants to merge 2 commits into
mainfrom
merge-queues
Open

ci: run required checks on merge_group events#586
martin-kolinek wants to merge 2 commits into
mainfrom
merge-queues

Conversation

@martin-kolinek

Copy link
Copy Markdown
Collaborator

Problem

Enabling the merge queue left PRs stuck in the queue until they timed out and were dequeued (observed on #583).

.github/workflows/main.yml only triggered on pull_request and push, 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-checks
  • codecov/patch
  • codecov/project

Branch protection requires all three, so the queue waited indefinitely. Verified against the merge-group commit for #583 (a4b4be3c): only anvil-pr (which already had the merge_group trigger), GitOps/GitHubPop, and license/cla reported — the three main.yml contexts were absent. license/cla already reports on merge groups, so it is unaffected.

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, already in history via fetch-depth: 0) 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 the required-checks fan-in treats skip as success.

Notes

The required-checks fan-in (if: always(), passes when every dependency succeeded or skipped) means PR-only jobs that skip on merge groups don't block the queue.

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
Copilot AI review requested due to automatic review settings July 17, 2026 13:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_group as 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 on merge_group.
  • Update delta and semver baseline selection logic to work correctly when github.base_ref is empty on merge-group events.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +263 to +266
# 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 }}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (ee31f7c) to head (46055d3).
⚠️ Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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
Copilot AI review requested due to automatic review settings July 17, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants