From 8b27788b3164f156cd7c166f6ea89ff9c36550ca Mon Sep 17 00:00:00 2001 From: Ran Trifon Date: Fri, 10 Jul 2026 10:07:15 +0300 Subject: [PATCH] Fix release tag availability check --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd95f13..b035fae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,13 +56,13 @@ jobs: throw "Requested version '$requested' does not match project version '$projectVersion'." } - git ls-remote --exit-code --tags origin "refs/tags/v$requested" *> $null - if ($LASTEXITCODE -eq 0) { - throw "Tag 'v$requested' already exists. Versions and tags are immutable." - } - if ($LASTEXITCODE -ne 2) { + $existingTag = git ls-remote --tags origin "refs/tags/v$requested" + if ($LASTEXITCODE -ne 0) { throw "Could not verify whether tag 'v$requested' exists (git exit code $LASTEXITCODE)." } + if (-not [string]::IsNullOrWhiteSpace(($existingTag -join ""))) { + throw "Tag 'v$requested' already exists. Versions and tags are immutable." + } $published = Invoke-RestMethod ` -Uri "https://api.nuget.org/v3-flatcontainer/sharedmemorystore/index.json" `