Home > Net >  Why can't I approve my own PR in GitHub, even when I have disabled the setting for "Requir
Why can't I approve my own PR in GitHub, even when I have disabled the setting for "Requir

Time:11-10

GitHub says I can disable protections that prevent the last pusher from approving the PR, but I am not able to even when I have that setting turned on. Is there some other setting I need to disable in my branch protections?

approval is blocked

here are my settings

I can still merge the pull request by bypassing the requirements (since I'm the administrator of the repository), but that's not what I want to do. I want to be able (and want other pushers to be able) to approve my own pull requests, as long as they are considered Code Owners (which I am, in this case).

I have tried enabling the setting and disabling it again. It does not seem to make a difference.

I created this PR before I even had branch protections turned on, and I turned off branch protections off altogether to confirm that the branch protection settings are indeed being updated.

I also tried requiring a PR but unchecking "require approvals" and leaving "require review from Code Owners" checked, and this did not work either.

CodePudding user response:

I have found the solution works for me; I am the only one working in the repository, so it may not be appropriate for other situations.

On the settings page, select "Branches". Select "Edit" in the Branch Protection Rule. Make sure that these two checkboxes are unchecked:

  1. Require approvals When enabled, pull requests targeting a matching branch require a number of approvals and no changes requested before they can be merged.
  2. Require approval from someone other than the last pusher Require review approval from someone other than the last pusher to the pull request branch.

CodePudding user response:

As TTT pointed out,

GitHub does not allow one to approve their own PRs that they created, ever.

The setting for "Require approval from someone other than the last pusher" is most likely an additional check on top of that, for if someone pushed to a PR that they did not create/own.

So it seems there is no way to enable the functionality that I wanted.

  • Related