Skip to content
Nx Cloud CI is in private beta 10.6× faster average CI time with 79% less compute. Join the beta
Back to Knowledge Base

Run Nx Cloud CI on a GitHub merge queue

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.

  1. Check that the GitHub App can receive merge group events. GitHub sends them only to apps that hold the Merge queues: Read repository permission and subscribe to the Merge group event, 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.

  2. 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: PR
    branches: [main]
    merge-queue:
    event: MERGE_GROUP
    branches: [main]

    branches and branches-ignore on a MERGE_GROUP trigger match the base branch of the merge group. paths, tags, and types aren't supported on it.

  3. Remove gh-readonly-queue/** from any PUSH trigger. With a MERGE_GROUP trigger in the file, that pattern starts a second run for every merge group, and both runs post the same check.

  4. 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 the name of the file, or its file name without the extension.

  • 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_BASE to 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.

Last updated: