Skip to content

Commit ffdb737

Browse files
committed
ci(ci): fix windows node.js path for bash using step outputs
- Add step id to capture node.js path from powershell - Convert windows path to bash format using regex replacement - Use github_output to pass path between steps - Export converted path in test step for windows runner
1 parent b54cda6 commit ffdb737

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ jobs:
3535
- name: Setup Node.js PATH (Windows)
3636
if: runner.os == 'Windows'
3737
shell: pwsh
38+
id: node_path
3839
run: |
39-
$nodePath = (Get-Command node).Source
40-
$nodeDir = Split-Path -Parent $nodePath
41-
echo "$nodeDir" | Out-File -FilePath $env:GITHUB_PATH -Append
42-
echo "Added to GITHUB_PATH: $nodeDir"
43-
node --version
40+
$nodeDir = (Get-Command node).Source | Split-Path -Parent
41+
$nodeDirBash = "/c" + ($nodeDir -replace ':\\', '/' -replace '\\', '/')
42+
echo "node_dir=$nodeDir" >> $env:GITHUB_OUTPUT
43+
echo "node_dir_bash=$nodeDirBash" >> $env:GITHUB_OUTPUT
44+
echo "Windows path: $nodeDir"
45+
echo "Bash path: $nodeDirBash"
4446
4547
- name: Format check
4648
shell: bash
@@ -55,6 +57,9 @@ jobs:
5557
- name: Test
5658
shell: bash
5759
run: |
60+
if [ "${{ runner.os }}" = "Windows" ]; then
61+
export PATH="${{ steps.node_path.outputs.node_dir_bash }}:$PATH"
62+
fi
5863
echo "PATH: $PATH"
5964
which node || echo "node not in PATH"
6065
deno test --allow-read --allow-env --allow-run

0 commit comments

Comments
 (0)