- Is it possible to have protection rules for repository which will apply to all branches?
- If we have pull request rule for all pushes, how can we make it exceptional for some users. Let’s say all uses must do pull request and cannot push the code, but user A can do push without pull request.
Hi @teodik ,
Question 1) You can create a branch protection rule in a repository for a specific branch, all branches, or any branch that matches a name pattern
See docs managing-a-branch-protection-rule
Question 2) I am not sure your branch protection rule example “all uses must do pull request and cannot push the code, but user A can do push without pull request” is possible.
Although if ‘Include administrators’ is not enabled on the branch protection rule it may not be enforced for a repository admin role user.
The branch protection rules are generally more focused on further protecting updates to repositories than the basic repository role permissions can give.
Thanks for information.
question 1: I am good.
question 2: we have service account for Jenkins and part of automated process is to merge release branches to master. I don’t want the service account not have any restriction, but on the same time it should be able to complete a merge and push changes without pull request. Otherwise, the Jenkins will fail. Additionally service account doesn’t have an admin role.