pull_request_read drops merge_commit_sha

未關閉 適合新手
#3,235 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
84/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
github, go
領域
api, backend

研究方向

從 pkg/github/pullrequests.go 開始,閱讀 GetPullRequest、convertToMinimalPullRequest 和 MinimalPullRequest。新增保留合併提交 SHA 的支援,然後驗證對於已合併的 pull request,使用 method get 的 pull_request_read 會公開 merge_commit_sha。

由索引模型根據 Issue 內容生成。

描述

bug
Describe the bug

pull_request_read with method: get does not return the pull request's merge_commit_sha, so there is no way to get from a merged pull request to the commit the merge produced without a second call.

In the source, GetPullRequest fetches the full pull request and then returns convertToMinimalPullRequest(pr). MinimalPullRequest carries merged, merged_at, merged_by, head and base, but has no merge_commit_sha field, so the value is dropped during conversion. merge_commit does not appear anywhere in pkg/github/pullrequests.go.

Affected version

Unknown. Observed through a hosted GitHub MCP integration on 2026-09-06, where the server version is not exposed to me. The code references above are from the repository's default branch on that date and may not match the build that was serving the request.

Steps to reproduce the behavior
  1. Call pull_request_read with method: get for a merged pull request.
  2. Inspect the returned object.
Expected vs actual behavior

Expected: merge_commit_sha is present for a merged pull request, as the REST API returns it.

Actual: the field is absent. Callers fall back to listing commits and matching on merge time or on the pull request number in the commit message, both of which are unreliable on an active branch.

Logs

None captured beyond the returned object.

主要語言
Go
星號
33.1k
分支
5k
平均合併
2 天 15 小時
30 天內合併 PR
27

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/github-mcp-server 的其他 Issue

查看 github/github-mcp-server 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。