Skip to main content
Version: v4

Blocking Merge

Reviewpad can be used to ensure pull requests are safely merged and follow the rules of our repository.

By taking advantage of GitHub branch protection rules and status checks we can configure Reviewpad to safely block a pull request from being merged.

Example

Let's say we want to block merging pull requests that modify the license of our repository.

We can achieve this by adding a workflow to our Reviewpad that disables the merge button when the LICENSE file is being modified on a pull request.

reviewpad.yml
workflows:
- name: unauthorized-license-workflow
description: Protect unauthorized modifications to the LICENSE
if:
- $hasFileName("LICENSE")
then:
- $disableMerge("Pull Requests should not change the LICENSE")
info

Using the fail built-in we can force reviewpad check to fail.

After which we can configure a branch protection rule on our GitHub repository and add the status check reviewpad to the list of required status checks.

Configure Status Check

With that in place, once a pull request tries to modify the LICENSE file in our repository, the merging ability will be blocked.

Merge button blocked