From b1bfbd3501b6521d3204b5d060f88a8f6153f945 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 19 Oct 2026 04:48:26 +0300 Subject: {actions,workflows}: 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. Also, while I'm at it, clean up the actions/workflows code a little bit. --- .github/actions/run-example/action.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to '.github/actions/run-example') diff --git a/.github/actions/run-example/action.yml b/.github/actions/run-example/action.yml index 9d3f90f..27210e9 100644 --- a/.github/actions/run-example/action.yml +++ b/.github/actions/run-example/action.yml @@ -1,30 +1,31 @@ name: Run example project description: Run example project inputs: - path: + install_dir: description: Installation directory required: true runs: using: composite steps: - env: - ARG_PATH: ${{ inputs.path }} + ARG_INSTALL_DIR: ${{ inputs.install_dir }} run: | - $path = $env:ARG_PATH + $install_dir = (Get-ChildItem env:ARG_INSTALL_DIR).Value - if ($env:CI_HOST_LINUX -and -not $env:CI_TARGET_LINUX) { - echo 'Not going to do that on Linux/MinGW' + if ((Get-ChildItem env:CI_HOST_LINUX).Value -and !(Get-ChildItem env:CI_TARGET_LINUX).Value) { + echo 'Not going to do that on Linux + MinGW' exit } - if ($env:CI_TARGET_LINUX) { - $lib = Join-Path $path 'lib' + if ((Get-ChildItem env:CI_TARGET_LINUX).Value) { + $lib = Join-Path $install_dir 'lib' if (Test-Path $lib) { $lib = Resolve-Path $lib $env:LD_LIBRARY_PATH = $lib } } - $exe_path = (Join-Path $path 'bin' 'foo') + $env:CI_EXE_EXT - echo "Executable path: $exe_path" - & $exe_path + $name = 'foo' + (Get-ChildItem env:CI_EXE_EXT).Value + $path = Join-Path $install_dir 'bin' $name + echo "Executable path: $path" + & $path shell: pwsh -- cgit v1.3