From time to time, when I get a single pull requests from the GitHub API the response contains the following attributes found in the JSON response:
"merged": false,
"mergeable": null,
"mergeable_state": "unknown",
"merged_by": null,
Why is that? How can I figure out if this pull request is mergeable or not? Do I really need to reload the pull request until I get a different response?
From one of the guys at GitHub:
The null value means that the mergeability of the pull request hasn't been computed yet. Mergeability is computed on demand and in the background, so when you fetch a pull request for which the mergeability isn't known -- you get back a null value but also a job is kicked off to compute the mergeability. If you make another request, you should see a non-null value for the mergeable attribute.
I guess implementing delayed retries is the way to go.
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 mergeable attribute can be true, false, or 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-null value for the mergeable attribute.
they don't record the result of why, only yes, no, or not yet computed.
I hope that helps 👍
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With