Workflow dispatch defaults to first repository's branch in multi-root workspaces
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
- 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
- Langage dominant
- TypeScript
- Étoiles
- 665
- Forks
- 221
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de github/vscode-github-actions
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
github/vscode-github-actions#627 · 2 réactions ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
github/vscode-github-actions#633 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 20/100
github/vscode-github-actions#630 · 3 commentaires · 3 réactions ·
-
long workOuverte
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
github/vscode-github-actions#628 ·
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
github/vscode-github-actions#625 ·
Toutes les issues de github/vscode-github-actions
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
one-zero-eight/apply-bot#39 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
bigbluebutton/bbb-ui-components-react#108 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
high priority
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
CI-CMG/deep-sea-corals-exb#84 · 1 commentaire ·