Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Workflow dispatch defaults to first repository's branch in multi-root workspaces

Aperta
#634 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
git, github-actions, typescript, vscode
Ambito
devtools

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

  1. Create a multi-root workspace containing two or more GitHub repositories.
  2. Check out different branches in the repositories, for example:
    • Repository A: branch-a
    • Repository B: branch-b
  3. Open a workflow_dispatch workflow from Repository B.
  4. Trigger the workflow using the editor action or GitHub Actions explorer.
  5. 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
Lingua principale
TypeScript
Stelle
666
Fork
218
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/vscode-github-actions

Tutte le issue di github/vscode-github-actions

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.