Skip to main content
Version: v4

Configuration

For Reviewpad to work, it needs a configuration file called reviewpad.yml in the root of your repository.

This configuration is where you define the automations that Reviewpad will run on every pull request.

There are two ways to add the reviewpad.yml configuration file to your repository:

Accept the onboarding pull request

After installing Reviewpad, an onboarding pull request is created in each repository where Reviewpad is installed.

You can accept the onboarding pull request by merging it.

By merging the onboarding pull request, the Reviewpad configuration file reviewpad.yml is added to the root of your repository.

That's it! 🎉

You are ready to use Reviewpad to automate your pull request process.

info

Please note that you will need to merge the onboarding pull request for each repository where Reviewpad is installed.

Didn't get the onboarding pull request?

If you have a lot of repositories, it might take a while for Reviewpad to create the onboarding pull requests.

If you don't see an onboarding pull request after a few minutes, please create the Reviewpad configuration file manually.

If you have any issues please reach us on our community server.

Create the Reviewpad configuration file manually

Create a file called reviewpad.yml in the root of your repository and add the following content:

reviewpad.yml
# This file is used to configure Reviewpad.
# The configuration is a proposal to help you get started.
# You can use it as a starting point and customize it to your needs.
# For more details see https://docs.reviewpad.com/guides/syntax.

# Define the list of labels to be used by Reviewpad.
# For more details see https://docs.reviewpad.com/guides/syntax#label.
labels:
small:
description: Pull request is small
color: "#76dbbe"
medium:
description: Pull request is medium
color: "#2986cc"
large:
description: Pull request is large
color: "#c90076"

# Define the list of workflows to be run by Reviewpad.
# A workflow is a list of actions that will be executed based on the defined rules.
# For more details see https://docs.reviewpad.com/guides/syntax#workflow.
workflows:
# This workflow calls Reviewpad AI agent to summarize the pull request.
- name: summarize
description: Summarize the pull request
run:
# Summarize the pull request on pull request synchronization.
- if: ($eventType() == "synchronize" || $eventType() == "opened") && $state() == "open"
then: $summarize()

# This workflow assigns the most relevant reviewer to pull requests.
# This helps guarantee that most pull requests are reviewed by at least one person.
- name: reviewer-assignment
description: Assign the most relevant reviewer to pull requests
run:
# Automatically assign reviewer when the pull request is ready for review;
- if: $isDraft() == false
then: $assignCodeAuthorReviewers()

# This workflow praises contributors on their pull request contributions.
# This helps contributors feel appreciated.
- name: praise-contributors-on-milestones
description: Praise contributors based on their contributions
run:
# Praise contributors on their first pull request.
- if: $pullRequestCountBy($author()) == 1
then: $commentOnce($sprintf("Thank you @%s for this first contribution!", [$author()]))

# This workflow validates that pull requests follow the conventional commits specification.
# This helps developers automatically generate changelogs.
# For more details, see https://www.conventionalcommits.org/en/v1.0.0/.
- name: check-conventional-commits
description: Validate that pull requests follow the conventional commits
run:
- if: $isDraft() == false
then:
# Check commits messages against the conventional commits specification
- $commitLint()
# Check pull request title against the conventional commits specification.
- $titleLint()

# This workflow validates best practices for pull request management.
# This helps developers follow best practices.
- name: best-practices
description: Validate best practices for pull request management
run:
# Warn pull requests that do not have an associated GitHub issue.
- if: $hasLinkedIssues() == false
then: $warn("Please link an issue to the pull request")
# Warn pull requests if their description is empty.
- if: $description() == ""
then: $warn("Please provide a description for the pull request")
# Warn pull request do not have a clean linear history.
- if: $hasLinearHistory() == false
then: $warn("Please rebase your pull request on the latest changes")

# This workflow labels pull requests based on the total number of lines changed.
# This helps pick pull requests based on their size and to incentivize small pull requests.
- name: size-labeling
description: Label pull request based on the number of lines changed
run:
- if: $size() < 100
then: $addLabel("small")
else: $removeLabel("small")
- if: $size() >= 100 && $size() < 300
then: $addLabel("medium")
else: $removeLabel("medium")
- if: $size() >= 300
then: $addLabel("large")
else: $removeLabel("large")

# This workflow signals pull requests waiting for reviews.
# This helps guarantee that pull requests are reviewed and approved by at least one person.
- name: check-approvals
description: Check that pull requests have the required number of approvals
run:
# Label pull requests with `waiting-for-review` if there are no approvals;
- if: $isDraft() == false && $approvalsCount() < 1
then: $addLabel("waiting-for-review")

# This workflow labels pull requests based on the pull request change type.
# This helps pick pull requests based on their change type.
- name: change-type-labelling
description: Label pull requests based on the type of changes
run:
# Label pull requests with `docs` if they only modify Markdown or txt files.
- if: $hasFileExtensions([".md", ".txt"])
then: $addLabel("docs")
else: $removeLabel("docs")
# Label pull requests with `infra` if they modify Terraform files.
- if: $hasFileExtensions([".tf"])
then: $addLabel("infra")
else: $removeLabel("infra")
# Label pull requests with `dependencies` if they only modify `package.json` and `package.lock` files.
- if: $hasFileExtensions(["package.json", "package-lock.json"])
then: $addLabel("dependencies")
else: $removeLabel("dependencies")

# This workflow validates that pull requests do not contain changes to the license.
# This helps avoid unwanted license modifications.
- name: license-validation
description: Validate that licenses are not modified
run:
# Fail Reviewpad check on pull requests that modify any LICENSE;
- if: $hasFilePattern("**/LICENSE*")
then: $fail("License files cannot be modified")

Reviewpad Installation - Step 3

Do not forget to push the file to the repository.

That's it! 🎉

Reviewpad will run on every pull request and follow the workflows defined in the reviewpad.yml configuration file.

Next steps

Now that you have configured Reviewpad you can start using it to automate your pull request process.

Have a look at our built-ins and use cases to see how Reviewpad can help you.

Terms and Conditions

By running Reviewpad, you are agreeing with Reviewpad's Terms and Conditions.