diff options
| author | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-02-05 16:07:29 +0000 |
|---|---|---|
| committer | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-02-05 16:07:29 +0000 |
| commit | d2fb93dee165c803416278ad3e4b869cd57e4182 (patch) | |
| tree | 0bcc223cd4ca593a502d18c231273e309731893b | |
| parent | 01af6508da67a04008919d72deec81b2944608fb (diff) | |
| download | gitinfo-d2fb93dee165c803416278ad3e4b869cd57e4182.tar gitinfo-d2fb93dee165c803416278ad3e4b869cd57e4182.tar.gz gitinfo-d2fb93dee165c803416278ad3e4b869cd57e4182.tar.bz2 gitinfo-d2fb93dee165c803416278ad3e4b869cd57e4182.tar.xz gitinfo-d2fb93dee165c803416278ad3e4b869cd57e4182.zip | |
use $LASTEXITCODE instead of try/catch in PowerShell test
| -rw-r--r-- | .github/workflows/test-validators.yml | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/.github/workflows/test-validators.yml b/.github/workflows/test-validators.yml index d3324ba..dae7308 100644 --- a/.github/workflows/test-validators.yml +++ b/.github/workflows/test-validators.yml @@ -4,17 +4,17 @@ on: push: branches: [main] paths: - - 'validators/**' - - 'gitinfo.schema.json' - - 'examples/**' - - '.github/workflows/test-validators.yml' + - "validators/**" + - "gitinfo.schema.json" + - "examples/**" + - ".github/workflows/test-validators.yml" pull_request: branches: [main] paths: - - 'validators/**' - - 'gitinfo.schema.json' - - 'examples/**' - - '.github/workflows/test-validators.yml' + - "validators/**" + - "gitinfo.schema.json" + - "examples/**" + - ".github/workflows/test-validators.yml" workflow_dispatch: jobs: @@ -69,13 +69,13 @@ jobs: shell: pwsh run: | '{"invalid_field": "should fail"}' | Set-Content /tmp/invalid.gitinfo - try { - ./validators/powershell/Validate-GitInfo.ps1 -Path /tmp/invalid.gitinfo - Write-Error "Expected validation to fail but it passed" + ./validators/powershell/Validate-GitInfo.ps1 -Path /tmp/invalid.gitinfo + if ($LASTEXITCODE -eq 0) { + Write-Host "Expected validation to fail but it passed" exit 1 - } catch { - Write-Host "Correctly detected invalid file" } + Write-Host "Correctly detected invalid file" + exit 0 test-bash: name: Test Bash Validator |
