I have a repository where branch protection rules are enabled, requiring at least one pull-request review before merging.
However, I want to introduce an exception to this rule:
If a pull request only modifies files named config.json located anywhere in the repository (for example, service-a/config.json, env/prod/config.json, etc.)
Then the PR should not require manual review
Ideally, the PR should be auto-approved or allowed to merge without review
A way to conditionally bypass branch protection rules based on changed file paths
Or an approach to automatically approve PRs when only */config.json files are changed
Branch restrictions are already enforced (1 review required)
The solution should be automated (Bitbucket Pipelines, etc.)
Preferably without weakening security for other file changes
Hi @Kavindu Kalinga ,
I’m afraid you can’t do it using only Bitbucket’s built-in checks, but you could build your own custom check and implement your logic above.
Alternatively, if you prefer an out of the box solution, we provide a Bitbucket app Flowie, which allow you to configure checks using conditions.
In your case, the relevant bit of the config, would look something like this:
minimumApprovals(
[changeset.allMatches("**/config.json"), 0],
[otherwise, 1]
)
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.