Docs say a PR from a linked branch is "automatically linked" to the issue, but it is not when the PR targets a non-default branch
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 82/100
- Issue 類型
- 文件
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- github
研究方向
從報告中連結的 creating-a-branch-for-an-issue 文章開始,將其中關於自動連結的措辭與連結的提取要求文章進行比較。確認文件中說明的預設分支條件,並更新受影響的段落,使其與觀察到的行為一致。當文章清楚說明自動連結何時發生,且相關的文件檢查通過時,即可完成。
由索引模型根據 Issue 內容生成。
描述
Code of Conduct
- I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
What part(s) of the article would you like to see updated?
The article states, with no condition on the pull request's base branch:
When you create a pull request for a branch that's connected to an issue, it is automatically linked to the issue, and the connection with that branch is removed with only the pull request shown in the "Development" section.
In practice this automatic linking does not happen when the pull request targets a branch other than the repository's default branch. The article should either state that the automatic linking requires the pull request to target the default branch, or the behaviour should be changed to match the current wording.
For comparison, the default-branch requirement is documented for closing keywords on Linking a pull request to an issue ("The pull request must be on the default branch."). There is no equivalent caveat on this page, so readers who create a branch from an issue reasonably expect the link to be created regardless of the base branch.
Additional information
Steps to reproduce (reproduced reliably, on a repository whose default branch is main):
- Create issue A. From its Development section, use "Create a branch" to create linked branch
feature/a. - Create issue B. Create linked branch
feature/bthe same way, based onfeature/a. - Push a commit to
feature/band open a pull request fromfeature/bwith basefeature/a(a stacked pull request).
Expected (per the article): issue B's Development section shows the pull request in place of the branch, and the pull request's closingIssuesReferences contains issue B.
Actual: issue B's Development section still shows the branch, and no pull request appears there. The pull request's closingIssuesReferences is empty, and no connected event is emitted on the issue timeline — only cross-referenced.
Repeating step 3 with base = main behaves exactly as documented: a connected event is emitted about two seconds after the pull request is created, and the branch entry is replaced by the pull request.
Notes
- Manually linking that same pull request to the issue from the Development sidebar does work with a non-default base, and the resulting link is a normal one (
closingIssuesReferencesbecomes populated). So this is not a blanket restriction on non-default base branches — only the automatic linking silently does not run. That asymmetry is what makes the current wording misleading. - Why this matters: in a stacked pull request workflow every pull request except the first one targets a non-default branch, so each one silently loses its issue link. Nothing in the UI indicates that the link is missing; it is only visible by querying
closingIssuesReferencesthrough the API, or by noticing that the Development section still lists a branch rather than a pull request. - Related, but not the same request: https://github.com/orgs/community/discussions/13240 asks for linked issues to be closed when a pull request merges into a non-default branch. This report is about the link not being created at all, which happens even before any merge.
- 主要語言
- TypeScript
- 星號
- 20.9k
- 分支
- 68.8k
- 平均合併
- 15 小時 4 分鐘
- 30 天內合併 PR
- 103
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/docs 的其他 Issue
-
builder persona content
難度 1/5 1 小時以內 新手友好度 90/100
-
localization
難度 2/5 1-2 天 新手友好度 72/100
-
content localization
難度 2/5 1-3 小時 新手友好度 78/100
-
content localization
難度 1/5 1 小時以內 新手友好度 92/100
-
content dependabot needs SME
難度 1/5 1 小時以內 新手友好度 82/100
相似的 Issue
-
comp/desktop P3 type/bug
難度 1/5 1 小時以內 新手友好度 92/100
NousResearch/hermes-agent#118866 ·
-
Browser Waiting for: Product Owner
難度 2/5 1-3 小時 新手友好度 85/100
getsentry/sentry-javascript#24577 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 78/100
agilepathway/label-checker#640 ·
-
Plugin stuck at "loading" on DSH 0.1.6-alpha.2 — turnTail list slot registration missing options.id 未關閉
難度 2/5 1-3 小時 新手友好度 88/100
-
難度 2/5 1-3 小時 新手友好度 68/100
chrisparsons83/flexspotff#153 ·