Download release assets with curl instead of gh api - #179
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gh apirefuses to write a response body containing terminal escape bytes. The--allow-escape-sequencesopt-out added in #178 works around that, but it only exists in gh >= 2.97.0, and theubuntu-latestpool 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 withunknown 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:
-fso an HTTP error fails the step underset -euo pipefailinstead of silently writing the error body out as a valid-looking asset, and-Lbecause the asset endpoint redirects to signed object storage. curl deliberately drops theAuthorizationheader 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) andpublish-draft-release.yml(manifest downloads, same version floor and the same latent failure). The JSON-returninggh apicalls are unaffected and stay as they are - gh is still the right tool for--paginateand--jq, just not for moving bytes. The remainingreleases/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