A GitHub merge queue tests each pull request combined with the ones queued ahead of it before it lands. Nx Cloud CI runs each merge group and reports the same required check it reports on pull requests.
Set up
Section titled “Set up”Check that the GitHub App can receive merge group events. GitHub sends them only to apps that hold the
Merge queues: Readrepository permission and subscribe to theMerge groupevent, and the Nx Cloud GitHub App has both. A new installation gets them when it's installed. An installation made before the app added them keeps working for pushes and pull requests, but an organization owner has to accept the updated permissions under Organization settings > GitHub Apps > Nx Cloud > Configure before Nx Cloud CI runs on the merge queues of that organization. Until then, GitHub sends no merge group events. A self-hosted app needs the permission and the event added in its own settings. For the steps, see custom GitHub App.Add a merge queue trigger next to the pull request trigger in
.nx/pipelines/ci.yaml. Keep the pull request trigger, because a pull request must pass the required check before it can be queued..nx/pipelines/ci.yaml on:pull-requests:event: PRbranches: [main]merge-queue:event: MERGE_GROUPbranches: [main]branchesandbranches-ignoreon aMERGE_GROUPtrigger match the base branch of the merge group.paths,tags, andtypesaren't supported on it.Remove
gh-readonly-queue/**from anyPUSHtrigger. With aMERGE_GROUPtrigger in the file, that pattern starts a second run for every merge group, and both runs post the same check.Require the check. In the branch ruleset, turn on Require merge queue and add
Nx Cloud: <name>under Require status checks to pass, with the Nx Cloud app as its source.<name>is thenameof the file, or its file name without the extension.
What a merge queue run does
Section titled “What a merge queue run does”- Runs on the head commit of the merge group and posts
Nx Cloud: <name>on it. - Shows in Nx Cloud under the queue branch,
gh-readonly-queue/<base>/pr-<number>-…, with a Merge queue badge. - Sets
NX_BASEto the base commit of the group, so only the queued changes count as affected. - Is cancelled when GitHub drops the group, because the pull request left the queue or a group ahead of it failed.
- Self-Healing CI and pull request comments do not run for merge queue runs.
In a step, if: nxcloud.event_name == 'merge_group' matches merge queue runs. For every trigger filter, see on.