Skip to content

ci: add merge_group trigger to enable GitHub merge queue - #9470

Open
Marzooqa wants to merge 2 commits into
masterfrom
WCI-1097-enable-merge-queue-on-bitgojs
Open

ci: add merge_group trigger to enable GitHub merge queue#9470
Marzooqa wants to merge 2 commits into
masterfrom
WCI-1097-enable-merge-queue-on-bitgojs

Conversation

@Marzooqa

Copy link
Copy Markdown
Contributor

Summary

Wires up the merge_group event in ci.yml so GitHub's merge queue has CI checks to gate on before landing PRs on master.

  • Add merge_group: types: [checks_requested] trigger
  • Fall back to github.sha for checkout ref (PR sha is null in queue context)
  • Fall back to master for GITHUB_BASE_REF when unset (merge_group context)
  • Skip commit-lint in merge_group — commits already vetted when the PR's own CI ran

The existing all-checks umbrella job serves as the required status check — no new jobs needed.

Remaining step (requires repo admin)

In Settings → Branches → Edit rule for master:

  • Enable Require merge queue
  • Strategy: ALLGREEN
  • Required status check: all-checks
  • Max entries to build: 2
  • Timeout: 60–120 min

Linear

WCI-1097

Adds the merge_group event so CI runs against the temporary stacked
branch GitHub creates when a PR enters the queue. Without this, the
queue has no checks to wait on and cannot gate merges.

Changes:
- Add merge_group: checks_requested trigger
- Fall back to github.sha for checkout ref (PR sha is null in queue context)
- Fall back to master for GITHUB_BASE_REF when unset (merge_group context)
- Skip commit-lint in merge_group — commits already vetted at PR CI time

A repo admin must also enable "Require merge queue" on the master branch
protection rule, set strategy to ALLGREEN, and require the all-checks job.

WCI-1097

TICKET: WCI-1097
@linear-code

linear-code Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

WCI-1097

@Marzooqa

Copy link
Copy Markdown
Contributor Author

@claude

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Claude finished @Marzooqa's task —— View job


Code Review Progress

  • Read and analyze CI workflow changes
  • Review merge_group implementation approach
  • Check for potential issues and improvements
  • Provide comprehensive review feedback

Code Review: GitHub Merge Queue Implementation

This PR correctly implements GitHub merge queue support in the CI workflow. The changes are well-thought-out and address the key requirements for merge queue functionality.

Strengths

1. Proper Event Trigger Configuration

merge_group:
  types: [checks_requested]
  • Correctly uses checks_requested trigger type for merge queue events
  • Follows GitHub's recommended pattern for merge queue integration

2. Robust Checkout Reference Handling

ref: ${{ github.event.pull_request.head.sha || github.sha }}
  • Smart fallback from PR head sha to github.sha for merge_group context (lines 71, 141, 198, 292, 366, 377, 394)
  • Prevents checkout failures when github.event.pull_request.head.sha is null in merge queue context

3. Base Reference Fallback Logic

git fetch origin ${GITHUB_BASE_REF:-master}
GITHUB_REPO_BRANCH=${GITHUB_BASE_REF:-master} yarn run check-commits
  • Properly handles missing GITHUB_BASE_REF environment variable in merge_group context (lines 90, 172-173)
  • Falls back to master branch when base ref is unset

4. Selective Commit Linting

if: matrix.check == 'commit-lint' && github.event_name != 'merge_group'
  • Intelligently skips commit linting for merge_group events (line 170)
  • Avoids redundant checks since commits were already validated during PR CI

5. Path Filter Updates

  • Updated comment on line 24 correctly describes new behavior including merge_group
  • changes job properly skips for merge_group, allowing dependent jobs to run unconditionally

🔍 Technical Analysis

Changes Job Behavior: The changes job only runs on pull_request events, which means for merge_group events it will be skipped. This causes downstream jobs that depend on it to run unconditionally (due to needs.changes.result == 'skipped' condition), which is the correct behavior for merge queue validation.

All-Checks Job: The existing all-checks umbrella job will serve as the required status check for merge queue, requiring no changes. This is a good architectural decision.

⚠️ Minor Observations

  1. Consistency Check: All checkout actions consistently use the same fallback pattern - good job maintaining consistency across 7 different checkout steps.

  2. Environment Variable Handling: The bash parameter expansion ${GITHUB_BASE_REF:-master} is used consistently in both git fetch and environment variable contexts.

📋 Verification Checklist

  • merge_group trigger properly configured
  • Checkout references handle null PR sha in merge context
  • Base reference fallbacks prevent fetch failures
  • Commit linting appropriately skipped for merge_group
  • Path filtering logic updated for new event type
  • No breaking changes to existing PR/push workflows

🎯 Recommendation

APPROVE - This is a solid implementation that follows GitHub merge queue best practices. The changes are minimal, focused, and address all the key requirements:

  1. ✅ Enables CI to run on merge queue events
  2. ✅ Handles context differences between PR and merge_group events
  3. ✅ Avoids redundant validation steps
  4. ✅ Maintains backward compatibility with existing workflows

The implementation is ready for the next step: enabling merge queue in branch protection settings with all-checks as the required status check.


Job Run | Branch: WCI-1097-enable-merge-queue-on-bitgojs

@Marzooqa
Marzooqa marked this pull request as ready for review August 12, 2026 08:11
@Marzooqa
Marzooqa requested review from a team as code owners August 12, 2026 08:11
pritam-gembali
pritam-gembali previously approved these changes Aug 12, 2026
mukeshsp
mukeshsp previously approved these changes Aug 13, 2026
Allows the API Spec Check to run during merge queue so stale CI
can't land broken commits on master. Previously, if master was broken,
any PR's API Spec Check would fail because the merge base was the broken
commit — the queue resolves this by always building against current master.

Changes:
- Add merge_group: checks_requested trigger
- Fall back to github.sha for checkout ref (PR sha is null in queue context)
- Fall back to master for base ref when unset (merge_group context)

WCI-1097

TICKET: WCI-1097
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.

5 participants