How to disable "Require approvals" for a protected branch with "Require a pull request before merging"?

We want to set up branch protection for our main branch so that no one can force push or accidentally delete it, and also require our team to open PRs instead of pushing to main directly.

Unfortunately, enabling “Require a pull request before merging” also enables “Require approvals” automatically:

But that is now what we want really - we want to require a pull request, but let people merge it without reviews on that branch.

Is there a way to configure this?

9 Likes

I’m seeing the same issue, not sure why the checkbox is disabled

Requiring pull request on a branch is very important IMHO, especially on main.
On the other side, requiring approvals isn’t as straight forward (because of the size of the team, onboarding on the workflow).

I’m not seeing why we could not protected the branch from direct push like we could before.

This looks like a UI bug. I “fixed” it for my repo by using inspect source to remove the disabled="disabled" attribute from that checkbox so I could uncheck it and hit save.

My “hack” seems to have worked because the UI now displays “Required number of approvals before merging: 0” and everything behaves as expected.

2021-10-26_00-00-25-13