-
I am trying to create a custom shell command in WSL that runs The regular github Unfortunately if I try to use that, I get a strange error:
The steps leading up to this look like this: - uses: Vampire/setup-wsl@v2.0.1
with:
distribution: Debian
additional-packages: |
gss-ntlmssp
cifs-utils
wget
ca-certificates
- name: Install PowerShell
shell: wsl-bash {0}
run: |
wget https://github.com/PowerShell/PowerShell/releases/download/v7.3.3/powershell_7.3.3-1.deb_amd64.deb
sudo dpkg -i powershell_7.3.3-1.deb_amd64.deb || sudo apt-get install -f
- name: Update shell
uses: Vampire/setup-wsl@v2.0.1
with:
wsl-shell-command: pwsh -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -Command ". '{0}'"
- name: Install Pester
shell: wsl-pwsh {0}
run: Install-Module Pester -Force My current workaround is to change the
This works fine to execute the file, but it has a major drawback: if the script being runs ends in an error, it does not fail the step in the workflow. This is I think a well-known pain point when running PowerShell scripts, which I believe the dot sourcing method that GitHub uses for its native pwsh/powershell steps gets around nicely. Only thing is that I can't figure out how to make that form work with this, and the error message is quite confusing. I've tried changing around the quotes (like I'd really appreciate any insight you have on either being able to use the dot source form, or getting a failed step to actually fail. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I don't think this has anything to do with the quotes or my action. To verify that, I used upterm to connect via SSH to the running WSL in the GitHub action. This gives the same error. Here your steps modified so that you could try yourself:
Then watch the action execution and you see the connection details. |
Beta Was this translation helpful? Give feedback.
I don't think this has anything to do with the quotes or my action.
The quotes should work just fine.
To verify that, I used upterm to connect via SSH to the running WSL in the GitHub action.
There I did
echo 'Install-Module Pester -Force' >/mnt/d/a/_temp/5d790ec0-d85c-4a27-818a-bec86ccd3414
.Then
pwsh
.And there
. /mnt/d/a/_temp/5d790ec0-d85c-4a27-818a-bec86ccd3414
.This gives the same error.
Here your steps modified so that you could try yourself: