@@ -5,6 +5,7 @@ $artifactPath = Join-Path $PSScriptRoot "artifacts/$([Guid]::NewGuid().ToString(
55New-Item - ItemType Directory - Path $artifactPath - Force | Out-Null
66
77$savedEnvironment = @ {}
8+
89foreach ($name in @ (' PATH' , ' GITHUB_ACTIONS' , ' GITHUB_OUTPUT' , ' GITHUB_STEP_SUMMARY' , ' GITHUB_WORKSPACE' , ' LGHA_TEST_FAILURE' ))
910{
1011 $savedEnvironment [$name ] = [Environment ]::GetEnvironmentVariable($name )
@@ -20,6 +21,7 @@ function Invoke-Scenario($Name, $Target, $Filter, $ExpectedExitCode = 0)
2021 $Env: GITHUB_OUTPUT = Join-Path $artifactPath " $Name -output.txt"
2122 $Env: GITHUB_STEP_SUMMARY = Join-Path $artifactPath " $Name -summary.md"
2223 $logPath = Join-Path $artifactPath " $Name .log"
24+
2325 $arguments = @ (
2426 ' -NoProfile' , ' -File' , " $actionPath /Invoke-SolutionOrProjectTests.ps1"
2527 ' -SolutionOrProject' , $Target
@@ -32,6 +34,7 @@ function Invoke-Scenario($Name, $Target, $Filter, $ExpectedExitCode = 0)
3234
3335 # Run in a child process so the action's exit and environment changes don't affect the test harness.
3436 & (Join-Path $PSHOME ' pwsh' ) @arguments * > $logPath
37+
3538 if ($LASTEXITCODE -ne $ExpectedExitCode )
3639 {
3740 Get-Content $logPath | Write-Output
@@ -40,6 +43,7 @@ function Invoke-Scenario($Name, $Target, $Filter, $ExpectedExitCode = 0)
4043}
4144
4245Push-Location $PSScriptRoot
46+
4347try
4448{
4549 $Env: PATH = (Join-Path $repositoryPath ' Scripts' ) + [IO.Path ]::PathSeparator + $Env: PATH
0 commit comments