Mandatory reviewers check during pull request creation.
Asked by Mohan Krishan:

Hello,

We want to setup a check during PR creation /opening. When we press create button, this check should identify that the provided reviewers list is a superset of repo default reviewers. i.e. all default reviewers are included in the PR reviewers list. If this check fails, a message should be displayed to the user and PR creation process should be aborted. Is their a plugin or mechanism to achieve this?

Regards,  
Mohan


Answers:
author: Ulrich Kuhnhardt _IzymesCo_
body: Hi Mohan,

it's Ulrich here from Izymes.

if I understand your question correctly you want to make sure that a mandatory set of reviewers is always included in pull requests.

So far Bitbucket (DC) lets you define default reviewers and when a PR is created the reviewers list is populated based on default reviewers, HOWEVER the list can be modified by the author of the PR.

You are implementing a more consistent PR review process which needs to make sure a certain set of mandatory reviewers is _always_ present.

If you define[mandatory reviewers](https://izymes.com/docs/workzone-predefine-pull-request-reviewers/) in [Workzone](https://marketplace.atlassian.com/apps/1211303/workzone-pullrequest-workflow?hosting=datacenter&tab=overview) - these individual mandatory reviewers or groups (AD groups or repo groups) will always be added when a PR is created. Even if the PR is edited and reviewers are removed, Workzone will add them back.

On top of that Workzone will require all or a minimum number of mandatory reviewers to approve before a PR can be merged.   
If you want to target different mandatory reviewers based on different files/paths you can set mandatory reviewers/group per file/path with minimum approval quotas as well. This is a huge time saver because mandatory reviewers are only added according to the PR's changeset (affected files).

Pheewww- that's a lot! Let me know if Workzone is something that would solve your problem and [we'll get you started](https://izymes.atlassian.net/servicedesk/customer/portal/1/group/1/create/3).

Cheers, Ulrich

// [Izymes](https://marketplace.atlassian.com/vendors/1210584/izymes-pty-ltd)

comments: author: Mohan Krishan
body: Hi Ulrich,

Thank you for the detailed information. We are already using Workzone for PR auto-merge feature. Let me try the reviewers use case; hope it will not conflict with default reviewers. I think i can set same set of default reviewers in Bitbucket and Workzone with same value for the minimum approval quota.

I also don't see any option to configure setting - all or a minimum number of mandatory reviewers to approve before a PR can be merged.

Regards,

Mohan


author: Ulrich Kuhnhardt _IzymesCo_
body: Hi Mohan,

good news: Workzone adds mandatory reviewer users or groups and enforces only approvals for mandatory reviewers configured in Workzone.

Workzone won't interfere with or be interfered by repository default reviewers and min approval count. Bitbucket will run the min approval count merge-check (on repo default reviewers) and Workzone will run the mandatory approval count merge-check (on workzone mandatory reviewers). Only if both are passing the PR can be merged. Default reviewers and mandatory reviewer namespaces can overlap (see below)

Workzone merge configuration for your PR (source-optional) and target branch allows you to set a mandatory approval quota, which could be the same as the BB repository min approval quota.

Here is a handy sketch that illustrates how repo default reviewers and workzone mandatory reviewers and merge control can work together

![min mandatory approvals.png](https://community.atlassian.com/t5/image/serverpage/image-id/315027iB7FA1179EB21CE9E/image-size/large?v=v2&px=999 "min mandatory approvals.png")

Hope all makes sense, let us know if we can be of any further assistance. Cheers Ulrich


author: Mohan Krishan
body: Thank you for the details. So, as per my understanding, approval quotas in Workzone can be set only with the automatic merge configuration. It can not be independently configured.


author: Mohan Krishan
body: Gentle reminder.


author: Ulrich Kuhnhardt _IzymesCo_
body: Hi Mohan,

this is correct. Workzone specific approval quotas (mandatory or else) are configured in the Workzone 'Merge' configuration for PR target branches or patterns.

If you don't specify a merge-configuration (with a quota) for mandatory reviewers, Workzone implies that 100% of mandatory reviewers on the PR must approve, I guess that's what you refer to as 'independent' reviewer configuration?


Tags: bitbucket-data-center

bitbucket-server

data-center

server