Reviewpad Documentation
website·Indexed 33 days ago
https://docs.reviewpad.com/Documentation for Reviewpad, a GitHub App designed to automate pull request workflows. It includes guides on the Aladino language for workflow specification, built-in functions like addAssignees and addLabel, merge protection via Reviewpad Protect, and AI-powered summarization using Reviewpad AI. The docs cover installation, configuration syntax, and tools like Reviewpad Check for identifying pull requests that require attention.
What's inside Reviewpad
- Reviewpad Check is a tool that identifies open Pull Requests requiring extra attention by flagging problematic patterns (such as high code churn or excessive review iterations). It is activated by default when Reviewpad is enabled and automatically flags PRs with dedicated labels. When an issue is detected, Reviewpad adds a label to the PR and creates a check report as a GitHub comment listing the identified issues.
Overview of Reviewpad
Reviewpad is a GitHub App designed to speed up, secure, and automate the code review process on GitHub. It automates manual tasks such as assigning reviewers, adding labels, and requesting formal approvals based on implicit team policies. It includes a feature called 'Reviewpad Check' (enabled by default) that flags open Pull Requests requiring extra attention using dedicated labels.Overview of Reviewpad Policy-as-Code
Reviewpad is a GitHub App that automates code review tasks (such as assigning reviewers, adding labels, and requesting approvals) based on areviewpad.ymlconfiguration file. This file must be located at the root of each repository where Reviewpad is enabled; otherwise, the app will not take any action.Define Reviewpad workflows
Workflows automate actions on GitHub entities. A workflow is defined by the following fields:
name: (Required) A unique string identifier for the workflow.description: (Optional) A string providing more details about the workflow.on: (Optional) A list of GitHub entity types that trigger the workflow. Defaults topull_request.trigger-on-check: (Optional) The unique ID of a check. The workflow only triggers when an issue is identified by that check.run: (Required) The action or list of actions to execute.
Reviewpad security and isolation model
Reviewpad executions are ephemeral and run in isolated environments. They do not communicate with each other, ensuring that there are no information leaks between different users or environments.Detect non-conventional commit messages with non-conventional-commits check
Thenon-conventional-commitscheck identifies pull requests that contain commit messages not complying with the Conventional Commits specification. Using this check ensures consistency in commit history, simplifies code reviews, and enables automated tools to generate release notes, changelogs, and version bumps.Generate a Message Report using built-in reporting functions
The Message Report is a GitHub comment automatically created by Reviewpad to collate multiple messages into a single comment, categorized by priority levels: INFO, WARNING, and ERROR. This report is triggered when using the built-in functions$reportInfo,$reportWarn, and$reportErrorwithin a Reviewpad configuration file.Detect git conflicts in pull requests using the git-conflict check
Thegit-conflictcheck (v4) automatically identifies pull requests that have git conflicts between theheadandbasebranches. This allows developers to resolve inconsistencies and integrity issues early in the PR lifecycle to avoid deployment delays.checks: git-conflict: label: git-conflict activation: onAdd warning messages to reports using reportWarning
ThereportWarningbuilt-in function (v4) allows you to add a specific warning message to the warnings section of a Reviewpad report. This is typically used within a workflow'sthenblock to alert developers about specific issues found during validation.workflows: - name: validate-changes run: if: $containsFilePattern("*.lock") then: $reportWarning("Please remove the lock file from the commit.")Apply Aladino typing constraints for rules and workflows
Aladino supports five value types:
booleans,numbers,strings,arrays, and_action_. To ensure a workflow is valid, you must adhere to two primary typing requirements:- Rule Specifications: The
specfield in a rule must evaluate to abool. Providing a string or other type will result in a type error. - Workflow Actions: The
thenblock (action) in a workflow must evaluate to the_effect_type. Providing a simple string will result in a type error.
# INVALID: spec must be bool, not string - name: doesnt-type-check-to-bool kind: patch description: Rule that does not type check to bool spec: "hello" # type error # INVALID: action must be _effect_, not string - name: invalid-workflow description: Invalid workflow because of action run: if: rule_1 then: "hello" # type error- Rule Specifications: The
Correct syntax for Reviewpad configuration strings and built-ins
To avoid parse errors in Reviewpad configurations, adhere to the following syntax rules:
- Strings: Always use double quotes (
") instead of single quotes ('). - Built-in Prefixes: All built-in functions must be prefixed with a dollar sign (
$). - Built-in Execution: Built-in functions must always include parentheses
(), even if they take no arguments.
# Correct Examples $addLabel("hello") # Use double quotes $containsFileName("README.md") # Use $ prefix $isMerged() # Use parentheses- Strings: Always use double quotes (
Iterate over groups and dictionaries in workflows
Reviewpad supports loops using the
forEachstructure to iterate over defined groups or dictionaries.in: Reference to the group (via$group("name")) or dictionary (via$dictionary("name")).value: An Aladino identifier to access the current element's value.key: An Aladino identifier to access the current key (used only for dictionaries).do: The action or list of actions to execute for each element.
# Example: Loop over a dictionary to assign teams based on file paths dictionaries: - name: approval-team-per-file-path spec: '**/authentication/**': '"security"' '**/db/**': '"dba"' workflows: - name: assign-by-path run: - forEach: key: $filePattern value: $teamName in: $dictionary("approval-team-per-file-path") do: - if: $containsFilePattern($filePattern) then: $addTeamsForReview([$teamName])