Sub topic 2
Required Checks in a Queued World
Assume you know Git branching, pull requests, branch protection or rulesets, and basic GitHub Actions syntax.
Required Checks in a Queued World
A pull request can pass its checks and still break main. Its checks may have run against an older version of main. Another pull request can merge before it, introducing an incompatible change.
A merge queue tests a proposed merge group instead. The group combines the latest main with one or more queued pull requests. Required checks must pass for that combined result before GitHub merges it.
A check required by branch protection or a ruleset must report successfully for the merge group. A successful check on only the pull request branch is not enough.
Running Workflows on `merge_group`
A workflow triggered only by pull_request will not run for the temporary merge group. Add the merge_group event:
name: CI
on:
pull_request:
branches: [main]
merge_group:
types: [checks_requested]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: make testThe merge_group event starts checks on the temporary commit that GitHub intends to merge. Keep the check names consistent between pull request runs and merge group runs. Otherwise, branch protection may wait for a status that never appears.
Choosing Queue Settings
Queue settings trade safety, speed, and CI cost.
| Setting | Effect |
|---|---|
| Merge method | Controls the final merge, such as squash |
| Maximum entries to build | Limits pull requests tested together |
| Check timeout | Removes or pauses groups whose checks take too long |
Use a small group size when tests are expensive or failures are difficult to isolate. Use a larger size when the team needs higher throughput and the test suite is reliable. Set the timeout above normal test duration, but low enough to expose genuinely stuck jobs.
Grouping Strategy and Failure Semantics
ALLGREEN requires every pull request in a group to pass. It gives strong validation but can make one failing pull request delay the others. The queue removes or rebuilds the affected group, and later pull requests may be tested again.
A strategy that favors the queue head can improve throughput when earlier pull requests should proceed independently. Choose it only when the team understands the weaker batching behavior and can handle more individual builds.
Exercise
Why must a required test workflow include merge_group?
Show answer
The queue tests a temporary merge group, and a workflow triggered only by pull_request will not report the required status for that commit.