From 750c2c8ac0abf843d0cb22107dbadf7dde68b325 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 18 Oct 2026 10:33:07 +0300 Subject: fail on unset environment variables The $env:NAME syntax fails to produce an error if $NAME is not defined, regardless of Set-StrictMode/Set-PSDebug. --- action.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 0d3c882..2d293ba 100644 --- a/action.yml +++ b/action.yml @@ -40,10 +40,10 @@ runs: $linux_host = '${{ runner.os }}' -eq 'Linux' $windows_host = '${{ runner.os }}' -eq 'Windows' - $mingw_version = $env:ARG_VERSION + $mingw_version = (Get-ChildItem env:ARG_VERSION).Value $mingw_version_supplied = $mingw_version -ne '' - $x64 = $env:ARG_PLATFORM -eq 'x64' + $x64 = (Get-ChildItem env:ARG_PLATFORM).Value -eq 'x64' $prefix32 = 'i686-w64-mingw32' $prefix64 = 'x86_64-w64-mingw32' @@ -54,7 +54,7 @@ runs: if ($path) { $path.Path } else { - Join-Path ${env:ProgramData} 'chocolatey' 'bin' 'choco' + Join-Path (Get-ChildItem env:ProgramData).Value 'chocolatey' 'bin' 'choco' } } @@ -169,7 +169,7 @@ runs: $linux_host = '${{ runner.os }}' -eq 'Linux' $windows_host = '${{ runner.os }}' -eq 'Windows' - $cc = $env:ARG_CC -eq '1' + $cc = (Get-ChildItem env:ARG_CC).Value -eq '1' function Link-Exe { param( @@ -193,8 +193,8 @@ runs: } if ($cc) { - Link-Exe $env:GCC cc - Link-Exe $env:GXX c++ + Link-Exe (Get-ChildItem env:GCC).Value cc + Link-Exe (Get-ChildItem env:GXX).Value c++ } shell: pwsh -- cgit v1.3