Skip to content

Commit 8853df1

Browse files
committed
fix: use hardcoded Git path for bash on Windows runners
Get-Command git fails when PATH contains MSYS-style entries. Directly reference C:\Program Files\Git\bin which is always present on GitHub-hosted Windows runners.
1 parent ba23dc1 commit 8853df1

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

.github/workflows/coverage-baseline.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,15 @@ jobs:
148148
- name: Ensure Git bash is on PATH (Windows)
149149
if: startsWith(matrix.os, 'windows')
150150
run: |
151-
$gitCmd = Get-Command git -ErrorAction SilentlyContinue
152-
if ($gitCmd) {
153-
$bashDir = Join-Path (Split-Path (Split-Path $gitCmd.Source)) 'bin'
154-
if (Test-Path $bashDir) {
155-
echo "$bashDir" >> $env:GITHUB_PATH
156-
}
151+
# Git for Windows is always installed on GitHub-hosted runners.
152+
# Add its bin dir so taiki-e/install-action can find bash.exe.
153+
# See https://github.com/actions/partner-runner-images/issues/169
154+
$gitBin = 'C:\Program Files\Git\bin'
155+
if (Test-Path (Join-Path $gitBin 'bash.exe')) {
156+
echo $gitBin >> $env:GITHUB_PATH
157+
Write-Output "Added $gitBin to PATH"
158+
} else {
159+
Write-Warning "bash.exe not found at $gitBin"
157160
}
158161
shell: pwsh
159162

.github/workflows/coverage.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,15 @@ jobs:
177177
- name: Ensure Git bash is on PATH (Windows)
178178
if: startsWith(matrix.os, 'windows')
179179
run: |
180-
$gitCmd = Get-Command git -ErrorAction SilentlyContinue
181-
if ($gitCmd) {
182-
$bashDir = Join-Path (Split-Path (Split-Path $gitCmd.Source)) 'bin'
183-
if (Test-Path $bashDir) {
184-
echo "$bashDir" >> $env:GITHUB_PATH
185-
}
180+
# Git for Windows is always installed on GitHub-hosted runners.
181+
# Add its bin dir so taiki-e/install-action can find bash.exe.
182+
# See https://github.com/actions/partner-runner-images/issues/169
183+
$gitBin = 'C:\Program Files\Git\bin'
184+
if (Test-Path (Join-Path $gitBin 'bash.exe')) {
185+
echo $gitBin >> $env:GITHUB_PATH
186+
Write-Output "Added $gitBin to PATH"
187+
} else {
188+
Write-Warning "bash.exe not found at $gitBin"
186189
}
187190
shell: pwsh
188191

0 commit comments

Comments
 (0)