Skip to content

Include merge_commit_sha in the minimal pull request result - #3241

Open
thejdubb02 wants to merge 1 commit into
github:mainfrom
thejdubb02:fix/3235-pr-merge-commit-sha
Open

Include merge_commit_sha in the minimal pull request result#3241
thejdubb02 wants to merge 1 commit into
github:mainfrom
thejdubb02:fix/3235-pr-merge-commit-sha

Conversation

@thejdubb02

Copy link
Copy Markdown
Contributor

Fixes #3235.

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.

This adds merge_commit_sha to the minimal result, populated only once the PR is merged. An open PR's merge_commit_sha is 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_at present, or merged) rather than emitted unconditionally. It is also added to listPullRequestsItemFieldEnum so list_pull_requests can 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 full pkg/github suite pass.

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.
@thejdubb02
thejdubb02 requested a review from a team as a code owner September 7, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pull_request_read drops merge_commit_sha

1 participant