fix: Handle 404 response in release existence check

This commit is contained in:
rcourtman
2025-12-26 16:49:37 +00:00
parent 4bcad25433
commit 9bd7e31843

View File

@@ -406,10 +406,11 @@ jobs:
IS_PRERELEASE="${{ needs.extract_version.outputs.is_prerelease }}"
# Check if a release already exists for this tag
# Note: gh api returns JSON error on 404, so check for valid release ID
EXISTING_RELEASE=$(gh api "repos/${{ github.repository }}/releases/tags/${TAG}" 2>/dev/null || echo "")
RELEASE_ID=$(echo "$EXISTING_RELEASE" | jq -r '.id // empty')
if [ -n "$EXISTING_RELEASE" ]; then
RELEASE_ID=$(echo "$EXISTING_RELEASE" | jq -r '.id')
if [ -n "$RELEASE_ID" ]; then
RELEASE_URL=$(echo "$EXISTING_RELEASE" | jq -r '.html_url')
IS_DRAFT=$(echo "$EXISTING_RELEASE" | jq -r '.draft')