0
votes

I'm trying to set a cross-repo branch policy to require approvals from admins anytime an azure-pipelines.yml file is touched. Seems easy:

  1. Go to project settings -> repositories
  2. Add a branch policy for "*" (all branches)
  3. Add an automatically included reviewer: 1 required from "Build Administrators"; pull request affecting these folders: /azure-pipelines.yml. (I've tried various versions of this path too, e.g. with out slashes, with wildcards, explicitly excluding everything else, etc)
  4. Save

The problem is it doesn't work. When I go and edit a file that is not azure-pipelines.yml file (e.g. readme.md), in a repo that has no other policies on it, I get stopped and it says I must submit a pull request. I would expect this commit to go through without a PR, since the policy does not include it. If I disable that automatically included reviewers policy, the commit goes through without a hitch.

I'm fully prepared to accept I'm using this incorrectly, but per the documentation, this seems like a bug. Anybody have any ideas? I've been trying various iterations of this for days.

1

1 Answers

1
votes

Based on my test, I could reproduce this situation.

When you set a path filter for ·automatically included reviewers·, this path filter only affects the reviewer's branch strategy.

This is a scene:

When you make some changes in *.yml file and create a pull request, the required reviewer will be automatically added. In other cases, this reviewer will not be added automatically.

This is the function of this path filter.

For Cross Repository branch policy:

If you set the branch policy for *(All Branches), this means that all branches cannot be directly pushed, they all needs to creat a pull request.

This will affect all repos.

When the branch policy exists, you need to pass a pull request to push changes. There is no path filter at the branch policy level temporarily. Therefore, the branch policy cannot be made to skip the files in the branch.

But this requirement is valuable, this is a suggestion ticket with similar functions, you can vote and add your ideas in it.