File tree Expand file tree Collapse file tree
.github/actions/clean-release-notes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,13 +130,15 @@ runs:
130130 PUBLISH : ${{ inputs.publish }}
131131 run : |
132132 set -euo pipefail
133- args=(--method PATCH "/repos/${REPO}/releases/${RELEASE_ID}" \
134- --raw-field "body=@${RUNNER_TEMP}/cleaned.md")
133+ # Build the JSON payload with jq so markdown content (newlines,
134+ # backticks, special chars) is correctly escaped. --rawfile reads
135+ # the cleaned body verbatim into a jq string variable.
135136 if [ "${PUBLISH}" = "true" ]; then
136- # -F sends typed JSON fields (booleans stay booleans).
137- args+=(-F draft=false)
137+ payload=$(jq -n --rawfile body "$RUNNER_TEMP/cleaned.md" '{body: $body, draft: false}')
138+ else
139+ payload=$(jq -n --rawfile body "$RUNNER_TEMP/cleaned.md" '{body: $body}')
138140 fi
139- gh api "${args[@]}" > /dev/null
141+ printf '%s' "$payload" | gh api --method PATCH "/repos/${REPO}/releases/${RELEASE_ID}" --input - > /dev/null
140142 if [ "${PUBLISH}" = "true" ]; then
141143 echo "Release ${RELEASE_ID} in ${REPO}: body patched + published."
142144 else
You can’t perform that action at this time.
0 commit comments