From b395697b8c9f384fdbfb73a39201792a25eb3d97 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 29 Sep 2024 19:48:41 +0900 Subject: [PATCH] Set `$PSNativeCommandUseErrorActionPreference = $true` in a workflow that uses pwsh (#806) Fixes GH-617 --- .github/workflows/windows.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index dce02789..89fe388b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -33,9 +33,19 @@ permissions: defaults: run: - shell: pwsh + # To respect exit code and make fail-fast behaviors. See GH-617 + shell: | + pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'" jobs: + inspect_runner: + runs-on: windows-2022 + steps: + - name: Print some variables which is applied in GH-617 + run: | + $PSVersionTable + $PSNativeCommandUseErrorActionPreference + $ErrorActionPreference # This job has many comment-out tyle note, agree to ugly, but do NOT remove for now. # See #443 for detail. #