Workflow dispatch defaults to first repository's branch in multi-root workspaces
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 62/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- git, github-actions, typescript, vscode
- 領域
- devtools
研究方向
Start in src/git/repository.ts, where getGitHead() reads git.repositories[0].state.HEAD, then follow its caller in triggerWorkflowRun.ts, which already has gitHubRepoContext for the selected workflow. Change the lookup so the ref comes from the workflow's own repository, and check that the default falls back to gitHubRepoContext.defaultBranch. Done when the dispatch ref prefills with the branch of the workflow's repository in a multi-root workspace.
由索引模型根據 Issue 內容生成。
描述
Description
When triggering a workflow_dispatch workflow from a multi-root VS Code workspace containing multiple Git repositories, the ref input is prefilled with the current branch of the first Git repository rather than the repository containing the selected workflow.
The workflow itself is dispatched against the correct repository, but the default ref often belongs to another repository. This requires manually correcting the branch on nearly every dispatch and can accidentally trigger a workflow on the wrong ref when branch names overlap.
Steps to reproduce
- Create a multi-root workspace containing two or more GitHub repositories.
- Check out different branches in the repositories, for example:
- Repository A:
branch-a - Repository B:
branch-b
- Repository A:
- Open a
workflow_dispatchworkflow from Repository B. - Trigger the workflow using the editor action or GitHub Actions explorer.
- Observe the value in Enter ref to trigger workflow on.
Expected behavior
The ref defaults to refs/heads/branch-b, the current branch of the repository containing the selected workflow.
Actual behavior
The ref defaults to refs/heads/branch-a, the current branch of the first repository known to VS Code's Git extension.
Probable cause
triggerWorkflowRun.ts correctly resolves gitHubRepoContext from the workflow file's workspace folder, but obtains the default ref through getGitHead():
value: (await getGitHead()) || gitHubRepoContext.defaultBranch
getGitHead() in src/git/repository.ts always reads git.repositories[0]:
const head = git.repositories[0].state.HEAD;
This ignores the workflow's workspace/repository context.
Suggested fix
Resolve HEAD from gitHubRepoContext.repositoryState, or change getGitHead to accept the workflow's workspace URI/repository context and retrieve the corresponding Git repository before reading HEAD.
Environment
- VS Code: 1.141.0 (
2a59476c9bfcb90b3ddc372c36762471b7dfad1c), x64 - GitHub Actions extension: 0.32.3
- OS: Windows
- Workspace: multi-root with multiple local GitHub repositories
- 主要語言
- TypeScript
- 星號
- 666
- 分支
- 218
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/vscode-github-actions 的其他 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 76/100
github/vscode-github-actions#627 · 2 個 reaction ·
-
難度 4/5 3-5 天 新手友好度 25/100
github/vscode-github-actions#633 ·
-
難度 5/5 一週以上 新手友好度 20/100
github/vscode-github-actions#630 · 3 則留言 · 3 個 reaction ·
-
long work未關閉
難度 4/5 3-5 天 新手友好度 25/100
github/vscode-github-actions#628 ·
-
bug
難度 3/5 1-2 天 新手友好度 55/100
github/vscode-github-actions#625 ·
查看 github/vscode-github-actions 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 77/100
apache/rocketmq-dashboard#6610 ·
維護者通常 3 天內回覆
-
nextjs-tracking
難度 2/5 1-3 小時 新手友好度 69/100
cloudflare/vinext#3920 ·
維護者通常 1 天內回覆
-
Team:Dashboards
難度 2/5 1-3 小時 新手友好度 65/100
elastic/kibana#297299 · 1 則留言 ·
維護者通常 1 天內回覆
-
analytics beginner friendly community contributions-welcome good first issue hacktoberfest help wanted up-for-grabs
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
affected/v17 affected/v18 area/frontend type/bug
難度 2/5 1-3 小時 新手友好度 82/100
umbraco/Umbraco-CMS#24186 ·
維護者通常 2 天內回覆