Skip to content

Commit 7a9217b

Browse files
authored
fix(ci): avoid "Argument list too long" in yarn-dedupe-push (#7666)
The base64-encoded yarn.lock content was passed as a shell argument to `gh api`, exceeding the Linux ARG_MAX limit. Write the base64 output to a temp file and use `jq --rawfile` + `gh api --input -` to keep large payloads off the command line.
1 parent 5936896 commit 7a9217b

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

.github/workflows/project.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,12 @@ jobs:
228228
229229
test -f "${{ runner.temp }}/yarn-lock-artifact/yarn.lock"
230230
sha="$(gh api -q '.sha' "repos/${OWNER}/${REPO}/contents/yarn.lock?ref=${BRANCH}")"
231-
content="$(base64 -w 0 "${{ runner.temp }}/yarn-lock-artifact/yarn.lock")"
232-
233-
gh api -X PUT "repos/${OWNER}/${REPO}/contents/yarn.lock" \
234-
-f message="chore: deduplicate yarn.lock" \
235-
-f content="${content}" \
236-
-f sha="${sha}" \
237-
-f branch="${BRANCH}"
231+
base64 -w 0 "${{ runner.temp }}/yarn-lock-artifact/yarn.lock" > "${{ runner.temp }}/yarn-lock-b64.txt"
232+
233+
jq -n \
234+
--arg message "chore: deduplicate yarn.lock" \
235+
--rawfile content "${{ runner.temp }}/yarn-lock-b64.txt" \
236+
--arg sha "$sha" \
237+
--arg branch "$BRANCH" \
238+
'{message: $message, content: $content, sha: $sha, branch: $branch}' \
239+
| gh api -X PUT "repos/${OWNER}/${REPO}/contents/yarn.lock" --input -

0 commit comments

Comments
 (0)