Skip to content

ci: add merge_group trigger to required-check workflows - #111

Open
williaby wants to merge 2 commits into
mainfrom
claude/add-merge-group-triggers-0
Open

ci: add merge_group trigger to required-check workflows#111
williaby wants to merge 2 commits into
mainfrom
claude/add-merge-group-triggers-0

Conversation

@williaby

@williaby williaby commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Problem

This repo's merge_queue ruleset (grouping_strategy: ALLGREEN, check_response_timeout_minutes: 60) requires four status checks: CI Gate, Security Gate Validation, Dependency & Standards Validation, and Check REUSE Compliance. None of the four pull_request workflows that emit these contexts also carried a merge_group: trigger.

Consequence: a PR entering the queue gets a merge-group build, but that build never dispatches the workflows above, so the required contexts never report. The entry sits at AWAITING_CHECKS, waits out the 60 minute timeout, and is ejected UNMERGEABLE. Without this fix, this repo's merge queue can never merge anything, regardless of how green the source PRs are.

This is self-healing: GitHub reads workflow files from the merge-group ref, which includes this PR's own commits, so this PR's own merge-group build (once queued) will emit the new contexts.

Workflows changed and why

  • .github/workflows/ci.yml: added merge_group: so job ci-summary (name CI Gate) runs under the merge queue.
  • .github/workflows/security-analysis.yml: added merge_group: so job security-gate-validation (name Security Gate Validation) runs under the merge queue.
  • .github/workflows/reuse.yml: added merge_group: so job reuse (name Check REUSE Compliance) runs under the merge queue.
  • .github/workflows/pr-validation.yml: added merge_group: so job validate-dependencies (name Dependency & Standards Validation) runs under the merge queue.

No other pull_request workflow in this repo emits one of the four required contexts, so no other file was touched (adding the trigger everywhere would double CI cost for no benefit).

Hazards handled

  • PR-title/body validation exists among the required contexts, and it needed the most care. pr-validation.yml's validate-dependencies job (the Dependency & Standards Validation required check) depends on title-check and body-check, both of which read github.event.pull_request.title / .body. Those fields are null under merge_group, so:
    • title-check and body-check are now guarded with if: github.event_name == 'pull_request' and simply do not run in the merge group (there is no PR title/body to validate there).
    • pr-validation-gate and validate-dependencies accept success or skipped per upstream job (not a blanket event-name bypass on the whole gate). A real failure on title-check/body-check still fails the gate under either event; only the "skipped by design under merge_group" case is tolerated. This aggregator does not wrap any separate dependency-scan job today (needs has always been [title-check, body-check] on main), so no scan result is being bypassed; a comment documents that the same per-job rule must be applied if a real scan job is ever added here. Both changes are tagged #CRITICAL/#VERIFY in the workflow comments; please watch the first live merge-group run to confirm the context actually reports green.
  • Concurrency group keyed on the PR ref. pr-validation.yml's concurrency.group was pr-validation-${{ github.event.pull_request.number }}, which evaluates to pr-validation- (empty) under merge_group. Changed to pr-validation-${{ github.event.pull_request.number || github.ref }} so a merge-group run gets its own group keyed on github.ref and cannot collide with, or cancel, a PR run's group (or vice versa). No other touched workflow has a PR-ref-keyed concurrency group.
  • Job-level event guards. No pre-existing job in the four touched workflows carried an if: github.event_name == 'pull_request' guard on the required-check job itself, so none of the required contexts were at risk of silently skipping in the merge group (the new guards on title-check/body-check above are additions to protect against null PR fields, not pre-existing guards that needed widening).

Verification

  • actionlint on all four changed files: no new findings beyond the pre-existing repo-wide shellcheck style/info baseline (verified by diffing actionlint output before/after on each file); the two new lines that were flagged for line-length were shortened, and >> $GITHUB_STEP_SUMMARY redirects touched by the rewrite were quoted.
  • pre-commit run on the changed files: all applicable hooks pass (yamllint, no-em-dash, detect-secrets, TruffleHog, etc.).
  • Confirmed via gh api .../rulesets that the four contexts above are the complete required-status-check set for this repo's default branch and merge queue; each has exactly one emitting job, and that job now runs on both pull_request and merge_group.

Generated with Claude Code

The merge_queue ruleset (grouping_strategy: ALLGREEN) requires CI Gate,
Security Gate Validation, Dependency & Standards Validation, and Check
REUSE Compliance, but none of the pull_request workflows that emit these
contexts also trigger on merge_group. A queued PR's merge-group build
never dispatches these workflows, so the required contexts never report,
the entry waits out the 60 minute timeout, and it is ejected UNMERGEABLE.
Without this fix the merge queue can never merge anything.

- ci.yml: adds merge_group so job 'CI Gate' reports under the merge queue.
- security-analysis.yml: adds merge_group so job 'Security Gate
  Validation' reports under the merge queue.
- reuse.yml: adds merge_group so job 'Check REUSE Compliance' reports
  under the merge queue.
- pr-validation.yml: adds merge_group so job 'Dependency & Standards
  Validation' reports under the merge queue; also guards title-check and
  body-check to pull_request only (github.event.pull_request.title and
  .body are null under merge_group), and updates the validation-gate and
  aggregator scripts to pass on a non-pull_request event instead of
  treating the now-skipped upstream jobs as failures. The concurrency
  group falls back to github.ref when github.event.pull_request.number
  is unset so a merge-group build cannot collide with, or cancel, a PR
  build's concurrency group.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 3, 2026 18:04
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: ac0d1eba-57fa-43cc-be1e-e61291622f97

📥 Commits

Reviewing files that changed from the base of the PR and between efcf21f and d846414.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .github/workflows/pr-validation.yml
  • .github/workflows/reuse.yml
  • .github/workflows/security-analysis.yml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The workflows now support GitHub merge-queue events. PR-specific checks skip unavailable metadata, while validation aggregators report skipped checks and allow merge-group runs to pass.

Changes

Merge queue CI support

Layer / File(s) Summary
Merge-group event routing
.github/workflows/pr-validation.yml
The PR validation workflow handles merge_group events, derives concurrency from the merge-group ref when needed, and limits title and body checks to pull request events.
Event-aware validation aggregation
.github/workflows/pr-validation.yml
Validation aggregators report skipped PR-only checks for merge-group events and retain failure handling for pull request events. Summary paths are quoted.
Merge-queue workflow coverage
.github/workflows/ci.yml, .github/workflows/reuse.yml, .github/workflows/security-analysis.yml
The CI, REUSE, and security analysis workflows now trigger for merge_group events.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to d8464

Merge-queue builds now run the required CI, security, dependency, and REUSE checks while PR-metadata-only validation is safely skipped for merge-group events. No current merge-readiness risk remains.

Suggested labels: ci

Poem

A rabbit sees the merge queue glow
New workflow paths begin to flow
PR-only checks rest when data’s thin
The merge-group gates can now begin
CI hops onward, clean and bright

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding the merge_group trigger to required-check workflows.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (4 skipped: 4 unsupported.)

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/add-merge-group-triggers-0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The merge_group triggers and the pr-validation.yml guards/if: always() setup ensure required check contexts will reliably emit on merge-queue refs without relying on PR-only event fields.

Pull request overview

This PR fixes GitHub merge queue deadlock by ensuring all workflows that emit the ruleset’s required status-check contexts also run on merge_group events, so merge-group refs can report the same required checks as PR refs.

Changes:

  • Added merge_group: triggers to the four workflows that emit the required contexts (CI Gate, Security Gate Validation, Dependency & Standards Validation, Check REUSE Compliance).
  • Updated pr-validation.yml to safely handle merge_group payloads (skip PR title/body jobs when no PR fields exist, and ensure required aggregator jobs still report success).
  • Adjusted pr-validation.yml concurrency grouping to avoid PR-run and merge-group-run collisions/cancellation.
File summaries
File Description
.github/workflows/ci.yml Triggers CI required-check workflow on merge_group so CI Gate reports for merge queue builds.
.github/workflows/security-analysis.yml Triggers security required-check workflow on merge_group so Security Gate Validation reports for merge queue builds.
.github/workflows/reuse.yml Triggers REUSE required-check workflow on merge_group so Check REUSE Compliance reports for merge queue builds.
.github/workflows/pr-validation.yml Triggers on merge_group and ensures Dependency & Standards Validation reports success even when PR-only checks are skipped; fixes concurrency group under merge_group.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Per-repo review flagged that checking github.event_name and returning
success unconditionally would blanket-pass the Dependency & Standards
Validation gate under merge_group, regardless of what any real upstream
job found. Replace that with a narrower rule: each upstream job's result
must be 'success' or 'skipped', evaluated individually. title-check and
body-check are the only jobs this gate aggregates today, and they are
'skipped' under merge_group by the pull_request-only guard added in the
previous commit (there is no PR title or body to check there); a real
'failure' on either job still fails the gate under both events. This
aggregator does not currently wrap any dependency-scan job (needs has
always been [title-check, body-check] on main), so no scan result is
being bypassed; the comment documents that the same per-job rule must be
applied if a real scan job is ever added here.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@williaby

williaby commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

Updated: the merge-group gate now accepts success-or-skipped per upstream job (title-check, body-check) instead of a blanket pass on non-pull_request events. A real failure in either check still fails the required Dependency & Standards Validation context under both pull_request and merge_group. This aggregator has never wrapped a real dependency-scan job (needs has always been [title-check, body-check] on main), so no scan result is bypassed by this change.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants