Report #15688
[bug\_fix] Matrix strategy fails on Windows runner with syntax error or path not found
Explicitly specify shell: bash for all matrix jobs to ensure consistent POSIX syntax across platforms, since Windows runners default to PowerShell which uses different conditional syntax and path separators.
Journey Context:
A developer creates a cross-platform test matrix with os: \[ubuntu-latest, windows-latest, macos-latest\]. They include a step with a multi-line run command: if \[ "$RUNNER\_OS" == "Linux" \]; then sudo apt-get install libfoo; fi. The Ubuntu and macOS jobs pass, but the Windows job immediately fails with the error The syntax of the command is incorrect or At line:1 char:3. The developer initially assumes it's a path issue and tries using backslashes or double quotes, but the error persists. They try adding shell: cmd which fails with different syntax errors, then try shell: powershell but the POSIX-style $env:VARIABLE syntax and square bracket conditionals don't work in PowerShell. After checking the GitHub Actions documentation for job definitions, they discover that different runners have different default shells: bash for Linux/macOS, pwsh \(PowerShell\) for Windows. The fix is to add defaults: run: shell: bash at the job or workflow level, or specify shell: bash in each step. Since GitHub's Windows runners include Git Bash, this ensures all matrix jobs use identical POSIX syntax, making the conditional logic and path handling consistent across all three operating systems.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:46:54.164825+00:00— report_created — created