Mergify| Docs

Request Reviews

Request reviews from specific users or teams.


The request_reviews action lets Mergify request reviews from specified users or teams. This is useful when you want to ensure specific team members review certain pull requests.

Parameters

Key nameValue typeDefault
users

list of string

or list of object

The username to request reviews from.

users_from_teams

list of string

or list of object

The team names to get the list of users to request reviews from.

teams

list of string

or list of object

The team name to request reviews from.

bot_account

template

Mergify can impersonate a GitHub user to request a review on a pull request. If no bot_account is set, Mergify will request the review itself.

random_countnumber

Pick random users and teams from the provided lists. When random_count is specified, users and teams can be a dictionary where the key is the login and the value is the weight to use. Weight must be between 1 and 65535 included.

Examples

Basic Assignment

Here's an example of how to use the request_reviews action:

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

Flexible Reviewers Assignment

You can assign people for review based on any criteria you like. A classic is to use the name of modified files to do it:

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

You can also ask entire teams to review a pull request based on, e.g., labels:

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

Random Review Assignment

It's not fair to ask for the same users or teams to always do the review. You can rather randomly assign a pull request to a group of users.

pull_request_rules:
- name: ask the security team to review security labeled PR
conditions:
- label=security
actions:
request_reviews:
users:
- jd
- sileht
- CamClrt
- GuillaumeOj
random_count: 2

In that case, 2 users from this list of 4 users will get a review requested for this pull request.

If you prefer some users to have a larger portion of the pull requests assigned, you can add a weight to the user list:

pull_request_rules:
- name: ask the security team to review security labeled PR
conditions:
- label=security
actions:
request_reviews:
users:
jd: 2
sileht: 3
CamClrt: 1
GuillaumeOj: 1
random_count: 2

In that case, it's 3 times more likely then the user sileht will get a pull request assigned rather than GuillaumeOj.

Edit on GitHub

Company

  • About Us
  • Careers
  • Customers
  • Media Kit

Products

Community

Help