Optimize your pull request workflow, tailoring review dismissal to specific scenarios and users.
Keeping your reviews up to date is essential to maintain a coherent and
reliable development workflow. Mergify offers a granular approach with the
Conditional Triggers: Only dismiss reviews when specific conditions on the pull request are met.
Selective Removal: Choose to remove only approvals, only reviews from particular users, or only changes requested.
Targeted Dismissal: Dismiss reviews only from users that are in the requested reviewers list.
Event-driven: Opt to have the action run when a PR is pushed again or keep it active continuously.
There are multiple scenarios where you can use this action to automatically remove change requests or approvals.
Automatically dismiss reviews when new commits are pushed to a PR targeting the main branch with a "re-review" label:
pull_request_rules:- name: dismiss reviews when new commits are pushed, if the label "re-review" is presentconditions:- base=main- label=re-reviewactions:dismiss_reviews:
Retain the approvals if the author is from a trusted team, even if they update their code:
pull_request_rules:- name: remove outdated reviews for non trusted authorsconditions:- base=main- author!=@mytrustedteamactions:dismiss_reviews:
Dismiss reviews from specific users, which can be useful if you have a bot user or a particular reviewer whose comments might not be relevant upon code changes:
pull_request_rules:- name: remove reviews from the bot when the PR is updatedconditions:- base=mainactions:dismiss_reviews:approved:- mybotusernamechanges_requested:- mybotusername
When a user request a new review from a reviewer, asking for a review does not dismiss the current review from the reviewer. You can do that using this snippet:
pull_request_rules:- name: dismiss reviews when review is requestedconditions:- base=mainactions:dismiss_reviews:approved: from_requested_reviewerschanges_requested: from_requested_reviewerswhen: alwaysmessage: "Review dismissed due to new review request."