Include merge_commit_sha in the minimal pull request result - #3241
Open
thejdubb02 wants to merge 1 commit into
Open
Include merge_commit_sha in the minimal pull request result#3241thejdubb02 wants to merge 1 commit into
thejdubb02 wants to merge 1 commit into
Conversation
pull_request_read (method get) and list_pull_requests return a trimmed MinimalPullRequest built by convertToMinimalPullRequest, which had no merge_commit_sha field, so a merged pull request gave no way to reach the commit the merge produced without a second call (github#3235). Add MergeCommitSHA to MinimalPullRequest and populate it, but only once the PR is merged. An open PR's merge_commit_sha is GitHub's ephemeral test-merge ref (refs/pull/N/merge), not a commit on the base branch, so gating on the merged signal (merged_at present, or merged) avoids handing that back as if it were the merge commit. Add merge_commit_sha to listPullRequestsItemFieldEnum so list_pull_requests can select it, and regenerate that tool's snapshot. Add a converter unit test asserting the field is emitted for a merged PR and withheld for an open or closed-unmerged one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3235.
pull_request_read(methodget) andlist_pull_requestsreturn a trimmedMinimalPullRequestbuilt byconvertToMinimalPullRequest, which had nomerge_commit_shafield, so a merged pull request gave no way to reach the commit the merge produced without a second call.This adds
merge_commit_shato the minimal result, populated only once the PR is merged. An open PR'smerge_commit_shais GitHub's ephemeral test-merge ref (refs/pull/N/merge), which is not a commit on the base branch, so it is gated on the merged signal (merged_atpresent, ormerged) rather than emitted unconditionally. It is also added tolistPullRequestsItemFieldEnumsolist_pull_requestscan select it, and that tool's snapshot is regenerated.Testing: a converter unit test asserts the field is emitted for a merged PR and withheld for an open or closed-unmerged one;
go build ./...,go vet,gofmt, and the fullpkg/githubsuite pass.