Request Reviews

Enhance your review workflow with customized, efficient, and dynamic review assignments tailored to your needs.


Mergify’s request_reviews action provides an enhanced mechanism to automate and personalize your review process, taking it several notches above GitHub’s conventional review assignment. By harnessing the versatility of pull request rules and conditions, you can define intricate workflows tailored to your team’s needs. Let’s explore how to utilize the action for various scenarios.

Below is a list of examples of what you could achieve with pull request rules and the request_reviews action.

Automatically request specific users or teams to review a pull request when it’s labeled with review. The rule checks for a pull request labeled review and then requests reviews from user1, user2, and team1.

pull_request_rules:
  - name: request review from users and team when pull request is labeled with `review`
    conditions:
      - label = review
    actions:
      request_reviews:
        users:
          - user1
          - user2
        teams:
          - team1

Dynamic reviewer assignments based on the content and context of pull requests.

Assign a Python expert to review changes in Python files.

pull_request_rules:
  - name: ask jd to review changes on python files
    conditions:
      - files ~= \.py$
    actions:
      request_reviews:
        users:
          - jd

For security-focused pull requests, you might want specialized teams to review.

pull_request_rules:
  - name: ask the security teams to review security labeled PR
    conditions:
      - label = security
    actions:
      request_reviews:
        teams:
          - "@myorg/security-dev"
          - "@myorg/security-ops"

Evenly distribute the review workload among team members.

This rule assigns two random users from a list of four to review pull requests labeled as review.

pull_request_rules:
  - name: randomly ask two members for review
    conditions:
      - label = review
    actions:
      request_reviews:
        users:
          - jd
          - sileht
          - CamClrt
          - GuillaumeOj
        random_count: 2

Define a hierarchy in the review process, with junior team members reviewing first. If changes affect critical components, senior members step in.

pull_request_rules:
  - name: junior review for all PRs
    conditions:
      - base = main
    actions:
      request_reviews:
        users:
          - junior1
          - junior2

  - name: senior review for critical components
    conditions:
      - base = main
      - files ~= ^critical/
    actions:
      request_reviews:
        users:
          - seniorDev

Expertise-based Review Assignment

Section titled Expertise-based Review Assignment

Ensure domain experts review relevant changes. If a PR modifies database-related files, request a review from the database expert.

pull_request_rules:
  - name: database expert review for database-related changes
    conditions:
      - files ~= ^database/
    actions:
      request_reviews:
        users:
          - dbExpert

Load Balancing Review Assignments

Section titled Load Balancing Review Assignments

Distribute reviews more fairly, ensuring certain team members aren’t overwhelmed.

pull_request_rules:
  - name: balanced review assignment
    conditions:
      - label = review
    actions:
      request_reviews:
        users:
          jd: 2
          sileht: 3
          CamClrt: 1
          GuillaumeOj: 1
        random_count: 2

Facilitate cross-team collaboration and knowledge sharing. When core components are changed, it’s beneficial to get insights from another team.

pull_request_rules:
  - name: cross-team review for core changes
    conditions:
      - files ~= ^core/
    actions:
      request_reviews:
        teams:
          - "@anotherTeam"

Allow authors to trigger specific domain reviews by adding labels.

pull_request_rules:
  - name: on-demand database expert review
    conditions:
      - label = request-db-review
    actions:
      request_reviews:
        teams:
          - dbExperts

Pull requests from new developers are first reviewed by mentors to ensure guidance.

pull_request_rules:
  - name: mentor review for new dev
    conditions:
      - author = newdev
    actions:
      request_reviews:
        users:
          - mentorUser

When critical files are modified, request multiple teams to collaboratively review the changes.

pull_request_rules:
  - name: multi-team review for critical changes
    conditions:
      - files ~= ^critical/
    actions:
      request_reviews:
        teams:
          - "@teamA"
          - "@teamB"

PRs marked as urgent get reviewed by a dedicated quick response team.

pull_request_rules:
  - name: urgent review request
    conditions:
      - label = urgent
    actions:
      request_reviews:
        teams:
          - "@quickResponseTeam"

With these comprehensive use cases, you’re well-equipped to optimize and customize your review workflows using Mergify’s request_reviews action. Adapt and mix these scenarios to perfectly fit your team’s unique requirements.