Repository navigation
Any gh command / any way to find the head-sha at the time of PR approval? #6615
|
A developer checks in some code in feature branch and creates a PR from that feature branch to "uat" branch. Even though it is not mandatory (i.e. not enabled in branch protections), someone reviews the PR and approves it. At this point, let's say head-sha is sha123. And then the developer makes some more change in the feature branch, which automatically become part of this PR. At this point, the head-sha is sha124. I am looking for a gh command or any way to find the head-sha at the time the PR was approved (sha123). I tried gh pr view ${PR_Number} --json commits,reviews . It does have a timestamp at submittedAt key. But that doesn't quite serve the purpose. I can take this timestamp of the "approved" review and compare it with timestamp in the commits section; but that's a little bit "involved" process. And I'll have to write code for timestamp comparison. Instead, if I I had a way of getting the head-sha / "oid" at the time of the approval, it'd be a lot easier. |
Replies: 1 comment 1 reply
|
Hi, every GitHub PR review records the exact commit ID for which it was made. However, this information isn't exposed in To work around this, you can query the REST API: gh api "repos/{owner}/{repo}/pulls/NUMBER/reviews" |
Hi, every GitHub PR review records the exact commit ID for which it was made. However, this information isn't exposed in
gh pr view --json reviewsdue to an omission on our part.To work around this, you can query the REST API:
gh api "repos/{owner}/{repo}/pulls/NUMBER/reviews"