Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

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

Ouverte
#634 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
62/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
git, github-actions, typescript, vscode
Domaine
devtools

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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
Langage dominant
TypeScript
Étoiles
665
Forks
221
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de github/vscode-github-actions

Toutes les issues de github/vscode-github-actions

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.