fix: pipe blob content via stdin to avoid ARG_MAX limit

The base64-encoded controller.json (~2.7MB) exceeds the OS argument
length limit when passed as a command-line argument to gh api via
-f "content=$(base64 ...)". This causes the blob creation step to
fail with "Argument list too long".

Pipe the content through base64 | jq | gh api --input - so the
payload never hits the command line.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rodrigo Horie
2026-06-17 15:59:33 -03:00
parent 4b4fafc79f
commit 6fd612a058

View File

@@ -147,11 +147,10 @@ jobs:
# Get the tree SHA from the base commit (base_tree requires a tree SHA, not a commit SHA)
BASE_TREE_SHA=$(gh api "repos/${SPEC_REPO}/git/commits/${BASE_SHA}" --jq '.tree.sha')
# Create blob and commit via API (commits created through the API are automatically signed by GitHub)
BLOB_SHA=$(gh api "repos/${SPEC_REPO}/git/blobs" \
-f "content=$(base64 -w 0 controller.json)" \
-f "encoding=base64" \
--jq '.sha')
# Create blob via API using --input to avoid ARG_MAX limit on large specs
BLOB_SHA=$(base64 -w 0 controller.json | \
jq -Rs '{content: ., encoding: "base64"}' | \
gh api "repos/${SPEC_REPO}/git/blobs" --input - --jq '.sha')
TREE_SHA=$(gh api "repos/${SPEC_REPO}/git/trees" \
-f "base_tree=${BASE_TREE_SHA}" \