Setting output path fails(?) using PowerShell running on windows-latest via mcr.microsoft.com/windows/servercore:ltsc2022 #567
-
Hey! I found your project after realizing I managed to run your tool, but my workflow fails locally with this:
Here's my workflow file., this is the interesting part: - name: Find .trx
id: trx
run: |
$path = (ls -Recurse -Filter *.trx | select -First 1).FullName
"path=$path" >> $env:GITHUB_OUTPUT Basically I try to dynamically find a file and set an output (as described in the official docs). On GitHub Actions this works, here's one of my runs (the run fails eventually, but this steps works). Any idea? I'm unsure I'm doing something wrong or is this a bug. This is how I run the runner: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I guess the problem here is you pwsh script is run using cmd (for the same reason sh is used for linux job containers). (that the log shows pwsh instead of cmd is a bug inherited by the actions/runner, where it only applies to linux)... My app basically rewrites your workflow a bit to have the container field set, but you are right making powershell default makes sense if you use the -P windows-latest=image syntax. Please try the following - name: Find .trx
id: trx
run: |
$path = (ls -Recurse -Filter *.trx | select -First 1).FullName
"path=$path" >> $env:GITHUB_OUTPUT
shell: powershell # or pwsh or put above your job, this makes your shell decision permanent without using defaults defaults:
run:
shell: powershell Does mcr.microsoft.com/windows/servercore:ltsc2022 contain powershell or pwsh? if not you need to change your image. |
Beta Was this translation helpful? Give feedback.
I guess the problem here is you pwsh script is run using cmd (for the same reason sh is used for linux job containers). (that the log shows pwsh instead of cmd is a bug inherited by the actions/runner, where it only applies to linux)...
My app basically rewrites your workflow a bit to have the container field set, but you are right making powershell default makes sense if you use the -P windows-latest=image syntax.
Please try the following
or put above your job, this makes your shell…