Auto-Add Reviewers to a Pull Request

This will automatically add some set of reviewers when a pull request is created. You would combine this with a condition so that for example:

  • pull requests from an outsourced team automatically include a senior reviewer from the onsite team

  • the mentors of new team members are automatically added as reviewers

You can add entire groups as well as, or instead of, named users. However, only those users that are active and are have the necessary permissions in the repository will be added.

Reviewers are split into two categories:

  • default reviewers - these reviewers are automatically added to the dialog when the pull request is created, but the pull request author can remove them

  • mandatory reviewers - these are shown with a padlock in the pull request create and edit dialogs, and cannot be removed

Use mandatory reviewers to enforce that certain users to get to review changes to important or sensitive code, or branches.

In the following example, a single user and the group authorised_devs, will be added as default reviewers for all pull requests (all because the condition is blank), in the selected repository.

Mr Senior Dev is added as a mandatory reviewer, and cannot be removed:

From Bitbucket 4.8 there is a feature that allows you to assign default reviewers for pull requests: BSERV-2924. These features can work alongside each other without interfering with each other, with one notable caveat. If you add default reviewers using the Bitbucket feature and set a certain number of them to be required, then reviewers added using the ScriptRunner event handler will not be able to approve or reject a pull request until one of the Bitbucket reviewers has weighed in. This is consistent with how Bitbucket Server’s default reviewers feature normally behaves. In short, the reviewers that are required to weigh in by Bitbucket Server settings will have the first say on a pull request.