cli / cli/cli

`gh pr merge` gives uninformative error message: "base branch policy prohibits the merge"

Open
#7,518 4 comments 0 reactions 0 assignees View on GitHub
blocked core enhancement gh-pr platform
Dominant language
Go
Stars
46.3k
Forks
9k
Avg merge
2d 9h
Merged PRs (30d)
89

Description

### Describe the feature or problem you’d like to solve

A clear and concise description of what the feature or problem is.

```console
$ gh pr merge https://github.com/foo/bar/pull/123 --merge
X Pull request #123 is not mergeable: the base branch policy prohibits the merge.
```

There are several different [branch protection rules](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/managing-a-branch-protection-rule) that one could have on a branch, so this error message doesn't really explain *why* the merge failed. Was it because a required check didn't pass? Was it because the PR wasn't approved by a maintainer? etc etc etc

### Proposed solution

Provide more context on *why* the merge failed, i.e. which branch protection rules have blocked it. e.g.
```
X Pull request #123 is not mergeable: the base branch policy prohibits the merge: required check "Build" has not passed
```
or
```
X Pull request #123 is not mergeable: the base branch policy prohibits the merge: PR requires approval from a maintainer
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.