Auto-merge

The ability to configure automatic PR merges can greatly unblock developers that typically wait for hours, or even days, to receive a LGTM review.

Since not every PR needs the same review process, using the semantic features of Reviewpad, you can configure many scenarios where auto-merge seems natural.

Out of the box, Reviewpad supports a merge action which can be used in multiple scenarios.

Auto-merge based on file properties

apiVersion: reviewpad.com/v0.0.4

labels:
  ship:
    description: ship mode
    color: 76dbbe

rules:
  changesToMDFiles:
    kind: patch
    description: Patch only contains changes to files with extension .md
    spec: $filesExtensions([".md"])

protectionGates:
  - name: ship
    description: Ship process - bypass the review and merge with rebase
    patchRules:
      - rule: changesToMDFiles
    actions:
      - $addLabel("ship")
      - $merge()

Auto-merge small PRs

apiVersion: reviewpad.com/v0.0.4

labels:
  ship:
    description: ship mode
    color: 76dbbe

rules:
  isSmallPatch:
    kind: patch
    description: Patch has less than 90 changes and 6 files
    spec: $size() < 90 && $fileCount() <= 5

protectionGates:
  - name: ship
    description: Ship process - bypass the review and merge with rebase
    patchRules:
      - rule: isSmallPatch
    actions:
      - $addLabel("ship")
      - $merge("rebase")

Auto-merge non-critical PRs

The hasAnnotation built-in can be used to configure powerful auto-merges. See a more in-depth example of the usage of hasAnnotation in the automated labelling section.

apiVersion: reviewpad.com/v0.0.4

labels:
  ship:
    description: ship mode
    color: 76dbbe

rules:
  notCriticalChanges:
    kind: patch
    description: Patch does not touch critical code
    spec: !$hasAnnotation("critical")

protectionGates:
  - name: ship
    description: Ship process - bypass the review and merge with rebase
    patchRules:
      - rule: notCriticalChanges
    actions:
      - $addLabel("ship")
      - $merge("rebase")

Did this page help you?