Skip to main content
Set up a PR Automation that merges a low-risk pull request once your conditions are met and the required checks pass.

Choose a setup

What you get

  • The automation selects open pull requests whose Merge risk is Minimal or Low and whose Review depth is Light.
  • CodeRabbit merges with its GitHub App, so your branch rules apply to it. If the branch requires a merge queue, CodeRabbit adds the pull request to the queue.
  • With Merge on conditions and checks, any matching pull request that meets GitHub’s requirements merges, with no approval unless your branch rule requires one.
  • With Also require a person’s approval, a pull request merges only after a person approves its latest commit, whether or not CodeRabbit approves too. If a commit lands after the approval, the automation checks again on the new commit and waits for a fresh approval.
  • Pull requests that already match when you save merge only if you select them.
To stop, select Pause on the automation’s row in PR Automations, or delete it. CodeRabbit re-checks the conditions before it merges, so a pull request that stops matching before the merge, such as one whose label you remove during setup, doesn’t merge. None of these takes a pull request out of GitHub’s merge queue or undoes a merge, which you revert in GitHub.

Before you start

| If the Auto-fix automation from Repair failing pull requests automatically already runs on these pull requests, step 1 turns off this automation’s own repairs, so only one of them pushes fixes. Optional: To tell CodeRabbit what counts as low risk for your team, describe it in Merge Risk Instructions.

Branch rule

For either setup, in the branch rule that protects the target branch:
  • Require the status checks that must pass before a merge.
  • Keep the CodeRabbit GitHub App off the ruleset’s bypass list. For classic branch protection, turn on Do not allow bypassing the above settings.
No approval requirement is needed. If the rule already requires approvals, GitHub still enforces them, and the merge waits for them.To check the rule before you create the automation, open a pull request against the branch. GitHub blocks merging until the required checks pass.

1. Create the merge automation

Once saved, this automation merges matching pull requests into your protected branch as soon as they meet GitHub’s requirements, with nobody pressing merge. You undo a merge only by reverting it in GitHub.
1

Start from the template

In PR Automations, select Try now on Merge low-risk changes. The editor opens with all repositories, the trigger conditions PR state is Open, Merge risk is any of Minimal, Low, and Review depth is Light, and a Squash merge with auto fix on.
2

Optional: Require a person's approval

If you chose Also require a person’s approval, under Triggers, select the + on the trigger card and set the new condition to Provider review decision is Approved. The conditions show and between them. Don’t use Add trigger: it adds a separate trigger joined by OR, which can merge without an approval.
3

Choose the repository

Under Repositories, choose Selected and pick the repository. Use a test repository first if you have one. The repository gets its own card.
4

Optional: Limit it to pull requests you opt in

To keep the automation from merging a pull request you didn’t mean to include while you check the results, on the repository’s card, select the +, set the new filter’s property to PR labels, keep has any of, and choose triage-trial. Anyone who can label pull requests, including the author, can opt one in. Without this filter, once you save, the automation merges every pull request in the repository that matches from then on.
5

Choose who repairs

If the Auto-fix automation already repairs these pull requests, or your organization has no Coding Agent access, set if PR requires fixes to Do not auto fix. Otherwise, keep Auto fix to repair failed checks and CodeRabbit findings before the merge. Each repair is a Coding Agent run that pushes a commit and can cost money.
6

Choose the merge method

In merge method, choose a method your branch rules allow. A branch that requires a merge queue always uses the queue.
7

Optional: Limit merge hours

To merge only while your team is around, set merge at to During selected hours, then select Merge hours and choose the days, hours, and timezone.
8

Save and enable

Select Save automation. This saves and enables it for future matches only. Without administrator access, the button reads Save as paused, and the automation doesn’t run until an administrator turns it on.

2. Optional: Merge pull requests that already match

1

Open the matches

On the automation’s row in PR Automations, select Preview matches. It appears only when something matches.
2

Select pull requests

Select the pull requests to merge now, then select Review selection.
3

Confirm

Confirm the selection. Each pull request merges once GitHub’s requirements pass.

Test it

1

Open a pull request

In the repository you selected, open a small, contained pull request. If you set the label filter, add the triage-trial label. The pull request doesn’t merge before the required checks pass.
2

Check the rating

Check that the Merge Risk line in CodeRabbit’s summary comment shows Minimal or Low for the latest commit and that the pull request’s Triage card shows Light review before you expect a merge. You can’t force either rating. Until CodeRabbit has reviewed the latest commit, or if either shows anything else, the automation doesn’t act on this pull request. To show review depth on cards, see What you can toggle.
3

Optional: Approve as a person

If you chose Also require a person’s approval, ask a teammate to approve the latest commit, since GitHub doesn’t let authors approve their own pull requests. Until then, GitHub reports that a review is required, and the pull request doesn’t merge.
4

Check the outcome

Once the required checks pass, and the approval if you require one, the pull request merges, or its Triage card shows Queued to merge. In PR Automations, select View activity to see the automation’s run on the pull request.

Widen the scope

If you set the label filter, remove it once View activity shows merges only where you expect them. From then on, the automation merges every pull request in the repository whose Merge risk is Minimal or Low and whose Review depth is Light, once it meets your setup’s requirements.
1

Open the automation

In PR Automations, select the pencil icon on the automation’s row.
2

Remove the label filter

On the repository’s card, select the X on the PR labels filter.
3

Save

Select Save changes. When if PR requires fixes is set to Auto fix, the button reads Save automation. Pull requests that already match merge only if you select them in Preview matches.

If something doesn’t work

  • The automation didn’t act. Check that the pull request’s ratings match Test it, then check the automation’s status and the pull request’s outcome in View activity. See An automation rule did not run.

Variations

  • Merge only the pull requests a person picks. Start from Merge labeled changes in place of Merge low-risk changes. It has no Merge risk or Review depth conditions, so the label filter stays for good and a person chooses every pull request. To also require an approval, add Provider review decision is Approved the same way. See Start with a template.
  • GitLab or Bitbucket. Support differs by provider and deployment, so check Provider availability. Where the provider can’t repair before merging, set if PR requires fixes to Do not auto fix, because the default Auto fix blocks matching pull requests. Provider review decision isn’t available on every provider, and PR labels filters work on GitLab but not on Bitbucket.

What’s next

Repair failing pull requests automatically

Fix failed checks and CodeRabbit findings on low-risk pull requests before they merge.

Remind reviewers in Slack

Nudge authors and reviewers about low-risk pull requests that wait for review.

Approval policies

Decide which approvals, if any, your branch rules require before anything merges.