Skip to content

Assign Reviewers by Directory

Automatically assign code reviewers based on directory structure. Optionally, you can substitue require-reviewers for add-reviewers to make review from the specified teams and individuals mandatory.

Assign Reviewers by Directory

Configuration Description

Conditions (all must be true):

  • The PR contains changes to JavaScript files inside the src/ui directory.

Automation Actions:

  • Add a user named my-teamate and a team named my-organization/ui-team as reviewers. These should be customized to match your organization.
  • Post a comment explaining why these reviewers were assigned.

Assign Reviewers by Directory

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  review_ui:
    # Triggered for PRs that contain any changes to JavaScript files inside the `src/ui` directory.
    if:
      - {{ files | match(regex=r/src\/ui\/.*/) | some}}
    # Add a specified user and team as reviewers.
    # Customize the reviewers to match your organization
    run:
      - action: add-reviewers@v1
        args:
          reviewers: [my-teamate, my-organization/security]
      - action: add-comment@v1
        args:
          comment: |
            The Security team has automatically been added for review because this PR contains changes to components inside `/src/ui`

Additional Resources

gitStream is a workflow automation tool that enables you to use YAML configuration files to optimize your code review process. Add context to PRs, find code experts for reviews, and automate the merge process to maximize developer productivity.

Learn More about how gitStream Works.

Related Automations:

More Automations can be found on the Automation Library and Integrations pages.