Skip to content

Confirm administrator privileges to merge a pull request when a repository requires it #1198

@doi-t

Description

@doi-t

Describe the feature or problem you’d like to solve

On GitHub.com UI, merging is blocked when a repository is configured to require approval(s).

If I'm an admin of the repository, I can use my administrator privileges like below.

Screen Shot 2020-06-06 at 10 21 57

To merge this PR, the UI shows a checkbox to confirm that I surely know I'm using my administrator privileges.

Screen Shot 2020-06-06 at 10 22 07

However, the current gh (v0.10.0) can merge a PR without such confirmation.

Proposed solution

I personally feel gh should follow the UI's behaviour because it is safer and better to indicate it explicitly. On the other hand, it makes additional user interaction and could be annoying if gh always ask us to check it. 🤔

I think there are some options.

  • Keep the current behaviour as gh's spec
    • In this case, gh considers that a user surely knows what they are doing with their administrator privileges
    • If it's already discussed and all intentional, please close this issue 🙇
  • Always confirm the privileges
    • Check BranchProtectionRule status before merge
    • Probably, it is the first question like below and "No" by default
    $ gh pr merge 636
    ? Use your administrator privileges to merge this pull request? [y/N]
    
  • Always confirm the privileges as same as above but add --force flag to gh pr merge to avoid the question (My preference)
    • Bonus: gh forceMerge 123 provided by gh alias set forceMerge pr merge --force can change the default behaviour if a user wants
  • Confirm administrator privileges to merge a pull request when a repository requires it #1198 (comment): Always reject to merge a pull request unless a user set --force option

Additional context

I found this necessity through the following interactions (Especially for handling a bunch of PRs generated by dependabot).

$ gh pr list # List up PR numbers and pick up one of them
$ gh pr merge 123 # Type a PR number which could go wrong by typo

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions