From 54a84c08b1eb9f608aa098895fb4dfc2015c9ffb Mon Sep 17 00:00:00 2001 From: IsraelAraujo70 Date: Wed, 29 Apr 2026 19:35:46 -0300 Subject: [PATCH] ci(release): respect gh api exit code when probing for existing release `gh api` writes the 404 JSON body to stdout (not just stderr), so the previous `existing=$(... 2>/dev/null || echo '')` pattern would set `existing` to `{"message":"Not Found",...}` whenever the release didn't exist yet. The script then took the "already exists" branch with `release_id=null`, the build matrix received `releaseId: null` and silently skipped uploads, and the finalize step blew up trying to PATCH release id `null`. Use `if existing=$(gh api ...); then` instead, which only enters the "exists" branch when the API call actually returned 200. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3086ac..bb11db5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,9 +56,8 @@ jobs: IS_TAG: ${{ steps.meta.outputs.is_tag }} run: | set -e - existing=$(gh api "repos/${{ github.repository }}/releases/tags/$TAG" 2>/dev/null || echo '') - if [ -n "$existing" ] && [ "$existing" != '' ]; then - release_id=$(echo "$existing" | jq -r .id) + if existing=$(gh api "repos/${{ github.repository }}/releases/tags/$TAG" 2>/dev/null); then + release_id=$(printf '%s' "$existing" | jq -r .id) echo "Release for $TAG already exists ($release_id)" else payload=$(jq -n \