Skip to content

Download release assets with curl instead of gh api - #179

Merged
jesserockz merged 1 commit into
mainfrom
jesserockz-2026-588
Aug 14, 2026
Merged

Download release assets with curl instead of gh api#179
jesserockz merged 1 commit into
mainfrom
jesserockz-2026-588

Conversation

@jesserockz

Copy link
Copy Markdown
Member

gh api refuses to write a response body containing terminal escape bytes. The --allow-escape-sequences opt-out added in #178 works around that, but it only exists in gh >= 2.97.0, and the ubuntu-latest pool serves mixed image versions while a new image rolls out. That makes it a per-job coin flip: on the esphome/bluetooth-proxies 26.8.2 release, 5 of 8 matrix devices passed and 3 (m5stack-atom-s3, wt32-eth01, lilygo-t-eth-poe) failed immediately with unknown flag: --allow-escape-sequences (run). There is no way to pin a hosted runner image version, so this cannot be waited out.

This swaps the asset-body downloads to curl, which has no version floor and no escape-sequence guard. Two flags are load-bearing: -f so an HTTP error fails the step under set -euo pipefail instead of silently writing the error body out as a valid-looking asset, and -L because the asset endpoint redirects to signed object storage. curl deliberately drops the Authorization header on the cross-host redirect, which is required here since the storage backend rejects a forwarded one, so no --location-trusted.

Both workflows using the pattern are covered: publish-firmware-to-r2.yml (firmware binaries, the one that failed) and publish-draft-release.yml (manifest downloads, same version floor and the same latent failure). The JSON-returning gh api calls are unaffected and stay as they are - gh is still the right tool for --paginate and --jq, just not for moving bytes. The remaining releases/assets/<id> calls elsewhere are DELETEs and uploads, which send binary in rather than writing a response body out, so the guard does not apply to them.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)

gh refuses to write a response body containing terminal escape bytes,
and the --allow-escape-sequences opt-out added in #178 requires gh
>= 2.97.0. The ubuntu-latest pool serves mixed image versions, so jobs
landing on an older gh die with "unknown flag" at random: 3 of 8 matrix
devices failed that way on the bluetooth-proxies 26.8.2 release.

curl has no version floor and no escape-sequence guard. -f keeps an HTTP
error from being written out as a valid-looking asset, and -L follows the
redirect to signed storage without forwarding the auth header. The
JSON-returning gh api calls are unaffected and stay as they are.
@jesserockz
jesserockz merged commit 2cf067d into main Aug 14, 2026
36 checks passed
@jesserockz
jesserockz deleted the jesserockz-2026-588 branch August 14, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant