Search code examples
tfstfs-2015

Branch Policy: Require atleast 1 Approval from specified approvers


We have 6 people on the project team: 1 Tech-lead and 1 Assistant Tech-lead.

In our branch policy we want to require that only the Tech-lead or Assistant Tech-lead can approve the pull request. We only need approval from one of them to avoid a bottleneck if the other one is on leave.

The problem is there are only 2 choices in the branch policy settings:

  1. Specifying the number of required approvers (which will not work since normal developers would be able to approve as well)
  2. Specifying the actual person to approve (which will not work since both of them will be required and cause a bottleneck when one is on leave)

Can someone please point us in the right direction?


Solution

  • You can provide required reviewers that are automatically added to each PR. These reviewers can also be groups.

    Do this:

    1. Create a group that contains your tech lead and assistant tech lead and.
    2. Make that group a required approver under Automatically include code reviewers

    You should get something like this: enter image description here

    Your statement normal developers would be able to approve as well is only true if the group that is required contains your normal developers.

    This way at least 1 person from provided group (in this case Developers) must approve a PR. If you want you can also provide a path filter to require only reviews on certain changes or assign a different group for files or folders.