Description
Powershell script execution is not working in Ubuntu 20.04 environment:
Run .\scripts\test.ps1
mkdir: cannot create directory ‘/run/user/1001’: Permission denied
checking
Virtual environments affected
Expected behavior
Powershell script should be run and executed without problems
Actual behavior
Script is not executed and will terminate to an error: mkdir: cannot create directory ‘/run/user/1001’: Permission denied
Repro steps
pwsh shellExample
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Run Powershell
shell: pwsh
run: ./scripts/test.ps1
Hello, @Satak
The bug was fixed in scope of this https://github.com/actions/virtual-environments/pull/2053 PR.
Temporary workaround:
-name : update pwsh
run: |
sudo apt-get update
sudo snap remove powershell
sudo apt-get install powershell
Workaround doesn't help:
Run .\scripts\test.ps1
test.ps1: /home/runner/work/_temp/679f6144-4c8c-4643-82d3-6a7ed6fe1e95.ps1:2
Line |
2 | .\scripts\test.ps1
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.
Error: Process completed with exit code 1.
@Satakm, you should call with pwsh:
pwsh -f .\scripts\test.ps1
Looks like the .\scripts\test.ps1 script contains errors.
You are right. Had problem in the script also which fixed this. Script works either with shell: pwsh or bash shell with pwsh -f ./scripts/test.ps1
Hello, @Satak
Has this issue been fixed ?
Can we close this ticket ?
Yes working now!