From 0d5aaae166559ed2659f126f72411ed2d159472e Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Tue, 4 Nov 2025 16:35:29 -0500 Subject: [PATCH 1/3] Error if swift crashes or version is empty --- action.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/action.yml b/action.yml index 54cf800..fa31a00 100644 --- a/action.yml +++ b/action.yml @@ -198,6 +198,14 @@ runs: id: swift-version run: | $Output = swift --version + if $LASTEXITCODE -ne 0 { + Write-Host "::error::Swift exited with code $LASTEXITCODE" + exit 1 + } + if ($Output.size -eq 0) { + Write-Host "::error::`swift --version` output is empty" + exit 1 + } $Match = ([regex]"\d+.\d+(.\d+)?").Match($Output) if ($Match.Success) { $SwiftVersion = [System.Version]($Match.Groups[0].Value) From 7c7d907f06bbfb352a0a140d92d14d00bb43581d Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Tue, 4 Nov 2025 16:42:37 -0500 Subject: [PATCH 2/3] s/size/Length --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index fa31a00..b865a55 100644 --- a/action.yml +++ b/action.yml @@ -202,7 +202,7 @@ runs: Write-Host "::error::Swift exited with code $LASTEXITCODE" exit 1 } - if ($Output.size -eq 0) { + if ($Output.Length -eq 0) { Write-Host "::error::`swift --version` output is empty" exit 1 } From 615801b1c572df7375daf6135537893c27e1ad93 Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Thu, 6 Nov 2025 13:04:01 -0500 Subject: [PATCH 3/3] Parens :( --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b865a55..abae6e1 100644 --- a/action.yml +++ b/action.yml @@ -198,7 +198,7 @@ runs: id: swift-version run: | $Output = swift --version - if $LASTEXITCODE -ne 0 { + if ($LASTEXITCODE -ne 0) { Write-Host "::error::Swift exited with code $LASTEXITCODE" exit 1 }