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.

Tokens
45.7K
Snippets
345
Records
400
Agent score
48%

What's inside Reviewpad

  1. Overview of Reviewpad Check

    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.
  2. 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.
  3. 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 a reviewpad.yml configuration file. This file must be located at the root of each repository where Reviewpad is enabled; otherwise, the app will not take any action.
  4. 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 to pull_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.
  5. 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.
  6. Detect non-conventional commit messages with non-conventional-commits check

    The non-conventional-commits check 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.
  7. 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 $reportError within a Reviewpad configuration file.
  8. Detect git conflicts in pull requests using the git-conflict check

    The git-conflict check (v4) automatically identifies pull requests that have git conflicts between the head and base branches. 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: on
  9. Add warning messages to reports using reportWarning

    The reportWarning built-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's then block 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.")
  10. 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:

    1. Rule Specifications: The spec field in a rule must evaluate to a bool. Providing a string or other type will result in a type error.
    2. Workflow Actions: The then block (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
  11. 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
  12. Iterate over groups and dictionaries in workflows

    Reviewpad supports loops using the forEach structure 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])