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.
GitHub does not allow to request more than 15 users or teams for a review.
Parameters
Key name | Value type | Default | |
---|---|---|---|
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 | |||
random_count | number | ||
Pick random users and teams from the provided lists. When |
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=reviewactions:request_reviews:users:- user1- user2teams:- 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 filesconditions:- 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 PRconditions:- label=securityactions: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 PRconditions:- label=securityactions:request_reviews:users:- jd- sileht- CamClrt- GuillaumeOjrandom_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 PRconditions:- label=securityactions:request_reviews:users:jd: 2sileht: 3CamClrt: 1GuillaumeOj: 1random_count: 2
In that case, it's 3 times more likely then the user sileht
will get a pull
request assigned rather than GuillaumeOj
.