git - What would cause a GitHub PR's merge commit SHA to be null - Stack Overflow

admin2025-05-01  1

I've merged a GitHub PR in one of my private repos and it has merged successfully. In the web UI I can see the commit has three SHAs:

  • the SHA for the commit which is the head of master
  • two parent SHAs
    • The head of the new branch
    • The previous head of master

So far so good. The problem is when I query the data from the API one of the SHAs is missing.

  • the head.sha is correct
  • the base.sha is correct
  • the merge_commit_sha is null.

The API says the PR state is closed and merged is true.

What would cause the merge commit sha to be null? How can I help make sure it's set? My CI relies on having this data available.

I've merged a GitHub PR in one of my private repos and it has merged successfully. In the web UI I can see the commit has three SHAs:

  • the SHA for the commit which is the head of master
  • two parent SHAs
    • The head of the new branch
    • The previous head of master

So far so good. The problem is when I query the data from the API one of the SHAs is missing.

  • the head.sha is correct
  • the base.sha is correct
  • the merge_commit_sha is null.

The API says the PR state is closed and merged is true.

What would cause the merge commit sha to be null? How can I help make sure it's set? My CI relies on having this data available.

Share Improve this question asked Jan 2 at 21:37 StaticMethodStaticMethod 8471 gold badge15 silver badges27 bronze badges 4
  • 2 I have the same issue, this breaks ReleasePlease, I'm starting to think this is a GH API bug, old pull requests return the merge_commit_sha in the REST API but PRs merged today aren't. – WelshProgammer Commented Jan 2 at 21:49
  • I am also encountering this problem, wondering if it's a Github API bug. Have you tried pagination options? Though I suspect they will yield the same result. EDIT: after testing pagition, it is still returning an empty set. – Arthur Le Maitre Commented Jan 2 at 21:55
  • "merged_at": "2025-01-02T13:55:17Z", "merge_commit_sha": "8a64d7c2d826dac65783e24b0d6e090880628bc0" up until: "merged_at": "2025-01-02T19:33:40Z", "merge_commit_sha": null Some time in that 6 hour period they stopped working. – WelshProgammer Commented Jan 2 at 22:00
  • I've opened a support ticket, will update here if/when I hear back from them. – WelshProgammer Commented Jan 2 at 22:10
Add a comment  | 

1 Answer 1

Reset to default 3

There's now a GitHub Incident since I opened a support case.

They seem to be resolving the issue, I'm seeing new PRs close with the SHA being properly returned:

gh api /repos/xxx/yyy/pulls --method GET -F state=closed | jq '.[] | "\(.merge_commit_sha) \(.merged_at)"'
"b25ca82e7c0a4e32013cf0672407c5c120c24f13 2025-01-02T22:55:30Z"
"null 2025-01-02T21:20:57Z"
"null 2025-01-02T20:41:30Z"
"null 2025-01-02T20:30:26Z"
"null 2025-01-02T20:20:02Z"
"null 2025-01-02T20:15:37Z"
"null 2025-01-02T20:04:19Z"
"null 2025-01-02T20:01:52Z"
"null 2025-01-02T19:43:13Z"
"null 2025-01-02T19:36:52Z"
"null 2025-01-02T16:34:14Z"
"null 2025-01-02T15:33:40Z"
"8a64d7c2d826dac65783e24b0d6e090880628bc0 2025-01-02T13:55:17Z"
"a3b277a14e2afbc603e2f8328b45ef76e756d9c3 2025-01-02T10:37:36Z"
"2cff84345a65ddbb641f22bba31f9995545797fc 2025-01-02T13:56:02Z"

Update, as of last night they provided this response:

All systems are operational, and we have a plan to backfill the missing metadata. In total, 139,000 PRs were impacted across 45,000 repositories. The backfilled metadata will be available in a few days.

Until the backfill is complete, there are several actions you can take to ensure an Action runs:

  • Any Actions that should have run on closed but not merged PRs can be triggered by re-opening and re-closing the PR.
  • Actions that should have run on PR merge can be re-run from the main branch of your repository.

The only Actions that cannot be re-run at this time are ones that specifically use the merge commit.

Additionally, the merge_commit_sha field on an impacted Pull Request will be null when queried via our API until the backfill completes.

We appreciate the error reports we received, and thank you for your patience. We mitigated the initial impact quickly by rolling back a feature flag. We will be improving the monitoring of our feature flag rollouts in the future to better catch these scenarios.

Posted 8 hours ago. Jan 03, 2025 - 00:19 UTC

Update We have remediated the issue> impacting Actions workflows. During investigation and remediation, we realized there were also issues with recording metadata around merge commits. No git data or code has been lost. PRs merged today between 20:06 UTC and 22:15 UTC are impacted. We are working on a plan to regenerate the missing metadata and will provide an update once we have one in place.

Posted 9 hours ago. Jan 02, 2025 - 23:11 UTC

转载请注明原文地址:http://anycun.com/QandA/1746095564a91602.html