Adjust required PR approval count based on directories


I understand that Github supports adjustment of the required approval count based on branches, but is there a way to control this on a more granular level? Specifically is there a way to adjust this value based on the directories that the Pull Request touches?

For example, if we have a directory /app/src/sensitiveFeature and anytime a developer touches the code in that directory, it’ll require X approvals?

Currently we are handling this manually by simply labeling PRs that needs X approvals, but we would love to remove this manual step and also actually enforce this at a GitHub level.

Any thoughts or ideas would be much appreciated, thanks!

You could use GitHub Workflow to run software that identifies which directory has changed and automatically applies the labels - automating the manual work

Thanks avelino for your input!
Good to know that GitHub Workflow could apply automatic labels – the end result we want to achieve is so that GitHub enforcing the “X approval needed to merge”, and while automating the label portion would be helpful, the solution we’re looking for is to have GitHub preventing merges if there are X approvals, where X could change based on the directory the files are touching

1 Like