What would you like Renovate to be able to do?
If automerge is enabled, I鈥檇 like to be given the reason why the pull request isn鈥檛 being merged.
Describe the solution you'd like
In the body of the pull requests, beside the automerge enabled indicator, the reason renovate is not currently merging the PR should be displayed.
Describe alternatives you've considered
Manually merging pull requests which are passing status checks and are fully rebased, due to not being aware of the reason for no automerge taking place.
Additional context
Several branch permissions can be configured, any of which could be preventing an automerge, there may be other situations outside of branch permissions which could also correspond to this state.
On removal of 'branch protection rules' from our master branch, automerges continued, which confirmed this issue for me.
We can probably cover a few of these reasons but not all branch protection rules may be easily visible to us at the API level unfortunately. I saw a case today where all status checks returned "success" yet mergeStateStatus = BLOCKED in the PR. i.e. GitHub isn't great at responding with "You can't merge because of X reason". We may need to query the branch protection rules themselves and try to reason from them why it doesn't work (e.g. check if there's a list of approved mergers and if we're on it, etc).
Needs some exploration of the GitHub API to determine which of the failure conditions we can determine and from which queries.
Maybe an idea: try automerge PR's as usual, if failed, check protection rules for possible causes. 馃
Maybe an idea: try automerge PR's as usual, if failed, check protection rules for possible causes. 馃
Good idea. If it takes any extra queries to determine then we should do it lazily and once per repo, as rules are common per-repo and not per-PR.
I was seeing the same kind of behavior here
DEBUG: getBranchStatus() result(branch="renovate/engines")
{
"branchStatus": "green",
"branchName": "renovate/engines"
}
DEBUG: Pull Request #4138 does not need updating(branch="renovate/engines")
DEBUG: Checking #4138 for automerge(branch="renovate/engines")
{
"automerge": true,
"automergeType": "pr",
"automergeComment": "automergeComment"
}
DEBUG: PR is configured for automerge(branch="renovate/engines")
DEBUG: PR is not ready for merge(branch="renovate/engines")
{
"canMergeReason": "mergeStateStatus = BLOCKED"
}
and adding Renovate to allowlist like below fixed it.

https://github.com/renovatebot/renovate/issues/846#issuecomment-528826053
It would be really great to have better logging here, the exact problem would be the best but a link to docs listing potential problems would be nice as well I think 馃槂
Most helpful comment
Good idea. If it takes any extra queries to determine then we should do it lazily and once per repo, as rules are common per-repo and not per-PR.