We can have the branch permissions at the Project level or at the repo level, requirement is - is there a way can we have the branch permissions at the folder level.
When developers raise a PR for code change, as per branch permission we have default reviewers to review and approve the PR's before merging. We can have different set of Default reviewers with respect to repos.
Similarly if any file changes is happening inside my xxx folder then particular reviewer should approve the PR. If there no changes happening inside xxx folder then anyone can approve and merge the PR.
For example, below is my folder structure and I have permissions at the repo level. X,Y and Z are the default reviewers. One approval needed to merge the PR.
Project A
-repoA
--folder1
-repoB
--folder2
--folder3
--folder4
developer raising a PR for repoB, if there is any change happening in folder4
then PersonX approval is mandatory to merge that PR.
if there is no changes is happening in folde4
then any approver can review, approve and merge the PR.
Let me know if this is possible to achieve!
You can achieve fine-granular pull request reviewer assignments and merge checks with Code Owners for Bitbucket.
In your example, to automatically assign "PersonX" to all changes that happen in "folder4" in a pull request, and to require one approval as a merge check (Bitbucket server/DC only), put a
CODEOWNERS
file like follows in your repository "repoB":For more information, please check the app's documentation.
Disclaimer: we are the authors of this app.