I can use the pull requests api to see whether a PR is mergeable, and I can use the status api to check custom statuses logged for a given commit, but how can I fetch the reason that a PR is blocked from merging (e.g. it could be merge conflicts, review obligations, commit status)?
There isn’t an API that summarizes why a PR is mergeable or not, only that it is or isn’t. In the documentation it states:
The value of the
mergeableattribute can be
null. If the value is
null, this means that the mergeability hasn’t been computed yet, and a background job was started to compute it. Give the job a few moments to complete, and then submit the request again. When the job is complete, the response will include a non-
nullvalue for the
We don’t record the result of why, only yes, no, or not yet computed.
I hope that helps
I also found the undocumented attribute
mergeable_state, which gives a little more info: it can be
unknown. It seems like
dirty means merge conflicts, so that’s been granular enough for me for now.