Skip to content

Commit e89436b

Browse files
voidstackloopclaude
andcommitted
release.yml: fix gh CLI misuse in the post-retry size re-check
The verify-and-retry step itself was crashing: `gh release view ... --jq --arg name "$name" '...'` mixes gh's own --jq flag (which takes exactly one filter-string argument) with jq's --arg flag, which gh doesn't understand as a passthrough. Everything after --jq's first token became extra positional arguments to `release view` (which only accepts one, the tag) — worse because this run's asset was actually named "Modelforge Setup 1.1.1.exe" (with spaces, the real electron-builder default), so gh saw 4 stray positional args and failed immediately with "accepts at most 1 arg(s), received 4" before ever getting to retry the upload. Fixed by re-fetching the full asset JSON via gh (as elsewhere in this script) and piping it through a plain `jq --arg` call, the same safe pattern already used for the first size check. Verified the underlying name/size-lookup logic against mock data (ghost asset correctly flagged, correctly-sized asset correctly skipped) since jq itself isn't installable in this sandbox without sudo — GitHub Actions runners have it by default. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent f16bbbb commit e89436b

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,16 @@ jobs:
180180
fi
181181
# Re-check size after the retry rather than trusting gh's exit
182182
# code alone — that's the exact assumption that let the
183-
# original silent failure through.
184-
new_size=$(gh release view "${{ github.ref_name }}" --repo "${{ github.repository }}" --json assets --jq --arg name "$name" '.assets[] | select(.name == $name) | .size')
183+
# original silent failure through. gh's own --jq flag takes a
184+
# single filter-string argument, not jq's --arg/--jq combo (an
185+
# earlier version of this line mixed the two, which made gh
186+
# treat the leftover tokens — including the two halves of an
187+
# asset name containing a space, "Modelforge Setup 1.1.1.exe"
188+
# — as extra positional args to `release view`, which only
189+
# accepts one: the tag). Re-fetching the full JSON and reusing
190+
# the same plain-jq --arg pattern as above avoids that entirely.
191+
published_json=$(gh release view "${{ github.ref_name }}" --repo "${{ github.repository }}" --json assets --jq '.assets')
192+
new_size=$(jq -r --arg name "$name" '.[] | select(.name == $name) | .size' <<< "$published_json")
185193
if [ "$new_size" != "$local_size" ]; then
186194
echo "::error::Asset '$name' still wrong size after retry (local: ${local_size}, remote: ${new_size:-none})."
187195
missing=1

0 commit comments

Comments
 (0)