@@ -107,19 +107,23 @@ jobs:
107107 fi
108108
109109 # Build file additions and deletions from the working tree.
110- ADDITIONS="[]"
111- DELETIONS="[]"
110+ ADDITIONS_FILE=$(mktemp)
111+ DELETIONS_FILE=$(mktemp)
112+ echo '[]' > "$ADDITIONS_FILE"
113+ echo '[]' > "$DELETIONS_FILE"
112114
113115 while IFS= read -r file; do
114116 if [ -f "${file}" ]; then
115- ADDITIONS=$(jq \
116- --arg path "${file}" \
117- --arg contents "$(base64 -w 0 "${file}")" \
118- '. + [{path: $path, contents: $contents}]' <<< "${ADDITIONS}")
117+ CONTENT_FILE=$(mktemp)
118+ base64 -w 0 "${file}" > "$CONTENT_FILE"
119+ jq --arg path "${file}" --rawfile contents "$CONTENT_FILE" \
120+ '. + [{path: $path, contents: $contents}]' "$ADDITIONS_FILE" > "${ADDITIONS_FILE}.tmp"
121+ mv "${ADDITIONS_FILE}.tmp" "$ADDITIONS_FILE"
122+ rm "$CONTENT_FILE"
119123 else
120- DELETIONS=$(jq \
121- --arg path "${file}" \
122- '. + [{path: $path}]' <<< "${DELETIONS}")
124+ jq --arg path "${file}" \
125+ '. + [{ path: $path}]' "$DELETIONS_FILE" > "${DELETIONS_FILE}.tmp"
126+ mv "${DELETIONS_FILE}.tmp" "$DELETIONS_FILE"
123127 fi
124128 done < <(git diff --name-only HEAD)
125129
@@ -129,8 +133,8 @@ jobs:
129133 --arg branch "${BRANCH}" \
130134 --arg oid "${HEAD_SHA}" \
131135 --arg headline "Release: ${{ steps.title.outputs.title }}" \
132- --argjson additions "${ADDITIONS} " \
133- --argjson deletions "${DELETIONS} " \
136+ --slurpfile additions "$ADDITIONS_FILE " \
137+ --slurpfile deletions "$DELETIONS_FILE " \
134138 '{
135139 query: "mutation($input: CreateCommitOnBranchInput!) { createCommitOnBranch(input: $input) { commit { oid } } }",
136140 variables: {
@@ -140,13 +144,15 @@ jobs:
140144 message: { headline: $headline },
141145 fileChanges: (
142146 {}
143- | if ($additions | length) > 0 then .additions = $additions else . end
144- | if ($deletions | length) > 0 then .deletions = $deletions else . end
147+ | if ($additions[0] | length) > 0 then .additions = $additions[0] else . end
148+ | if ($deletions[0] | length) > 0 then .deletions = $deletions[0] else . end
145149 )
146150 }
147151 }
148152 }' | gh api graphql --input -
149153
154+ rm "$ADDITIONS_FILE" "$DELETIONS_FILE"
155+
150156 echo "branch=${BRANCH}" >> "${GITHUB_OUTPUT}"
151157
152158 - name : Create or update release PR
0 commit comments