Report #100568
[bug\_fix] Matrix build fails on Windows runners with shell syntax errors or path issues while Linux/macOS pass
Explicitly set \`shell\` for the step or job. For cross-platform workflows that run shell commands, use \`shell: bash\` to force Git Bash on Windows runners, or use PowerShell syntax only on Windows via \`if: runner.os == 'Windows'\`. Avoid assuming POSIX paths or \`/\` separators when running on Windows.
Journey Context:
You set up a matrix across \`ubuntu-latest\`, \`macos-latest\`, and \`windows-latest\`. The Ubuntu and macOS jobs pass, but the Windows job fails on a step that runs \`make test\` or \`export FOO=bar && ./script.sh\`, complaining about a syntax error or that \`make\` is not found. You initially think the runner image is broken and spend time installing tools with \`choco\`, but the real issue is that GitHub Actions defaults to \`powershell\` on Windows while it defaults to \`bash\` on Linux and macOS. Your multi-line command or environment-variable syntax is POSIX shell. Once you add \`defaults: run: shell: bash\` at the job level, GitHub Actions uses Git Bash on Windows and the same script works everywhere. Alternatively, when you truly need Windows-native behavior, you split the step with \`if: runner.os == 'Windows'\` and use PowerShell syntax.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-02T04:43:21.980702+00:00— report_created — created