From 57d45f136ee5064fc86713acca21cb6534b19dbe Mon Sep 17 00:00:00 2001 From: Camryn Carter Date: Sat, 11 Apr 2026 17:26:29 -0700 Subject: [PATCH] handle large diff passed to gh api (#553) --- .github/workflows/cherrypick.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cherrypick.yml b/.github/workflows/cherrypick.yml index cae3f13..38ab0e8 100644 --- a/.github/workflows/cherrypick.yml +++ b/.github/workflows/cherrypick.yml @@ -164,10 +164,11 @@ jobs: --arg path "$file" \ '. + [{"path": $path, "mode": "100644", "type": "blob", "sha": null}]') else - CONTENT=$(base64 -w 0 "$file") + # Write blob payload to a temp file to avoid argument list limits + base64 -w 0 "$file" | jq -Rs '{"content": ., "encoding": "base64"}' > /tmp/blob.json BLOB_SHA=$(gh api repos/${REPO}/git/blobs \ - -f content="$CONTENT" \ - -f encoding="base64" \ + --method POST \ + --input /tmp/blob.json \ --jq '.sha') FILE_MODE=$(git ls-files -s "$file" | awk '{print $1}') [ -z "$FILE_MODE" ] && FILE_MODE="100644" @@ -335,10 +336,10 @@ jobs: --arg path "$file" \ '. + [{"path": $path, "mode": "100644", "type": "blob", "sha": null}]') else - CONTENT=$(base64 -w 0 "$file") + base64 -w 0 "$file" | jq -Rs '{"content": ., "encoding": "base64"}' > /tmp/blob.json BLOB_SHA=$(gh api repos/${REPO}/git/blobs \ - -f content="$CONTENT" \ - -f encoding="base64" \ + --method POST \ + --input /tmp/blob.json \ --jq '.sha') FILE_MODE=$(git ls-files -s "$file" | awk '{print $1}') [ -z "$FILE_MODE" ] && FILE_MODE="100644"