Skip to main content
Version: 3.16.0

Syntax

A Reviewpad configuration file has the following shape:

api-version: reviewpad.com/v3.x

mode: MODE [OPTIONAL]
ignore-errors: IGNORE_ERRORS [OPTIONAL]

labels:
label_1
label_2
...
label_N

groups:
group_1
group_2
...
group_N

rules:
rule_1
rule_2
...
rule_N

workflows:
- workflow_1
- workflow_2
...
- workflow_N

pipelines:
- pipeline_1
- pipeline_2
...
- pipeline_N
note

You can check the latest formal version of the format here.

If you use VSCode, we recommend that you setup yaml.schemas to enjoy syntax checking and auto-completion.

API Version

The api-version property is the version of Reviewpad specification format.

The version is necessary so the format can be evolved, and the field is used for the parser to know how to interpret the content.

Example

api-version: reviewpad.com/v3.x

Mode

The mode property is a flag that allows you to enable or disable reports of Reviewpad as a pull request comment.

By default, Reviewpad runs on silent mode. However, you can choose to use verbose mode and Reviewpad will comment on the pull request with the execution results and, when the pull request is merged, the metrics.

The metrics report includes the following metrics:

  • Coding Time: the time it took from the first commit until the pull request was issued;
  • Pickup Time: the time since the pull request was issued until its first review;
  • Review Time: the time from the first review until the pull request was merged.

Metrics Report

Example

mode: verbose # optional

Ignore errors

The ignore-errors property is a flag that allows you to specify if the Reviewpad should ignore execution errors.

By default, this flag is false which means that Reviewpad will fail if an error is raised.

Example

ignore-errors: true # optional

Label

A label specifies a label that can be used as an argument to the label related functions.

The structure of a label is as follows:

LABEL-ID:
name: STRING [OPTIONAL]
description: STRING [OPTIONAL]
color: STRING [OPTIONAL]
  • LABEL-ID of a label is used to reference it in other entities. If no name is provided, then the LABEL-ID is considered the name.
  • name [OPTIONAL] is the name of the label as seen on GitHub.
  • description [OPTIONAL] is a short description of the label. Must be 100 characters or fewer.
  • color [OPTIONAL] is the hexadecimal color code for the label, with or without the leading #.

If the label does not exist in the repository, it will be created.

If the label already exists in the repository and the description set in the reviewpad.yml file is different from the description in the repository then this descritpion will be updated to the description defined in the reviewpad.yml file.

Example

labels:
small:
name: small # optional
description: Defines a small pull request # optional
color: d2697a # optional

Group

A group specifies a list of entities. At the moment, we only support GitHub users.

There are two ways to specify a group:

Group By Enumeration

- name: STRING
description: STRING [OPTIONAL]
kind: developers
spec: "[LIST OF GITHUB USERS]"
  • name of a group is used to reference it in other entities.
  • description [OPTIONAL] is a string that can be used to provide more details about the group.
  • kind of a group can only be developers at the moment.
  • spec is an Aladino array.

Example

groups:
- name: seniors
description: project seniors # optional
kind: developers
spec: '["peter"]'

Group By Filter

- name: STRING
description: STRING [OPTIONAL]
kind: developers
type: filter
param: VARIABLE
spec: ALADINO-BOOLEAN-EXPRESSION
  • name of a group is used to reference it in other entities.
  • description [OPTIONAL] is a string that can be used to provide more details about the group.
  • kind of a group can only be developers at the moment.
  • type with filter specifies that we will require a param and a boolean spec.
  • param declares the name of a variable representing a single developer.
  • spec is an Aladino boolean expression that uses the param variable to define a condition on which developers should be part of the group.

Example

groups:
- name: new-joiners
description: Groups of developers that have created less than 10 pull requests # optional
kind: developers
type: filter
param: dev
where: $totalCreatedPRs($dev) < 10

Rule

A Reviewpad rule specifies a boolean condition on a pull request.

The structure of a rule is as follows:

- name: STRING
kind: [patch | author] [OPTIONAL]
description: STRING [OPTIONAL]
spec: ALADINO-BOOLEAN-EXPRESSION
  • name of a rule is used to reference it in other rules and workflows.
  • kind [OPTIONAL] of a rule can be either patch or author. The kind is related to different properties of pull requests that will be used in the evaluation of the spec field.
  • description [OPTIONAL] is a string that can be used to provide more details about the rule.
  • spec is a boolean expression in Aladino.

Example

rules:
- name: small-change
kind: patch # optional
description: Checks if the pull request size is small # optional
spec: $size() < 30

Workflow

A workflow is a specification of a list of actions to be executed if the pull request satisfies any of the specified rules.

The structure of a workflow is as follows:

- name: STRING
description: STRING [OPTIONAL]
always-run: BOOLEAN [OPTIONAL]
on:
- [pull_request | issue]
if:
- rule: REF_TO_RULE_1 | INLINE_RULE_1
extra-actions: [OPTIONAL]
- ACTION_1
- ACTION_2
...
- ACTION_N
...
- rule: REF_TO_RULE_N | INLINE_RULE_N
then: [OPTIONAL]
- ACTION_1
- ACTION_2
...
- ACTION_N
  • name is a string that identifies the workflows.
  • description [OPTIONAL] is a string that can be used to provide more details about the workflow.
  • always-run [OPTIONAL] field is a boolean that specifies if the workflow should run regardless of whether the previous workflows ran or not. If true then the workflow will always run. If false then the workflow will run only if none of the previous workflows have run. By default, this field is false. For instance, if a workflow B has a precedent workflow A and both have always-run: false then workflow B will run only if workflow A has not run. If the workflow B has always-run: true then it will run regardless of whether workflow A has run or not.
  • on [OPTIONAL] field is a list of GitHub entity types that should trigger the workflow. By default, the value is pull_request.
  • if field specifies which rules should be checked. For each rule, we can also specify a list of extra actions that will be executed if this rule is activated by the pull request.
  • then field is a list of Reviewpad actions that should run.

Example

workflows:
- name: size-labelling
description: Label pull request based on size # optional
on: # optional
- pull_request
if:
- rule: $size() < 90
extra-actions: $addLabel("small")

This configuration specifies one workflow called size-labelling which automatically labels a pull_request with the label small if the inline rule $size() < 90 is true. This means that the total number of changed lines i.e. $size is lower than 90.

Pipeline

The structure of a pipeline is as follows:

- name: STRING
description: STRING [OPTIONAL]
trigger: [STRING | RULE] # optional
stages:
- actions:
- ACTION_1
- ACTION_2
...
- ACTION_N
until: [STRING | RULE] # optional
...
- actions:
- ACTION_1
- ACTION_2
...
- ACTION_N
until: [STRING | RULE] # optional
  • name is a string that identifies the pipeline.
  • description [OPTIONAL] is a string that can be used to provide more details about the pipeline.
  • trigger [OPTIONAL] field is a rule that if true enables the pipeline.
  • stages is a list of stages of the pipeline. Each stage is a list of actions that will execute until the until condition is true.

Example

pipelines:
- name: security-changes
trigger: '$hasFilePattern("services/db/migrations/**")'
stages:
- actions:
- '$assignReviewer(["john"], "reviewpad")'
until: $reviewerStatus("john") == "APPROVED"
- actions:
- '$assignTeamReviewer(["security"])'

This configuration specifies one pipeline called security-changes which is triggered when there are changes to the files in the database migration and these files will be first reviewed by john and only when john approves the changes, they will be reviewed by the security team.