Skip to content

Commit 72a4003

Browse files
reid-spencerclaude
andcommitted
Fix notify-blog body encoding with proper JSON serialization
Use jq -Rs to safely JSON-encode the multiline release body instead of shell string interpolation via gh api -f. Fetch the body from the GitHub releases API (works for both release events and manual workflow_dispatch). Send as raw JSON via --input to avoid shell quoting issues with special characters. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a355564 commit 72a4003

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,33 @@ jobs:
192192
env:
193193
TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }}
194194
steps:
195-
- name: Dispatch blog post creation
195+
- name: Fetch release body
196+
id: release
196197
env:
197198
GH_TOKEN: ${{ secrets.BLOG_DISPATCH }}
198199
run: |
199-
# Fetch release body - works for both release events and manual dispatch
200200
BODY=$(gh api repos/ossuminc/riddl/releases/tags/${TAG} --jq '.body' 2>/dev/null || echo "")
201201
if [ -z "$BODY" ]; then
202202
echo "::warning::Could not fetch release body for ${TAG}"
203203
fi
204+
# Write to file to avoid shell quoting issues
205+
echo "$BODY" > /tmp/release-body.txt
206+
207+
- name: Dispatch blog post creation
208+
env:
209+
GH_TOKEN: ${{ secrets.BLOG_DISPATCH }}
210+
run: |
211+
BODY=$(cat /tmp/release-body.txt)
204212
gh api repos/ossuminc/ossum.ai/dispatches \
205213
--method POST \
206-
-f event_type=riddl-release \
207-
-f "client_payload[product]=riddl" \
208-
-f "client_payload[version]=${TAG}" \
209-
-f "client_payload[release_url]=https://github.com/ossuminc/riddl/releases/tag/${TAG}" \
210-
-f "client_payload[body]=${BODY}"
214+
--input - <<PAYLOAD
215+
{
216+
"event_type": "riddl-release",
217+
"client_payload": {
218+
"product": "riddl",
219+
"version": "${TAG}",
220+
"release_url": "https://github.com/ossuminc/riddl/releases/tag/${TAG}",
221+
"body": $(echo "$BODY" | jq -Rs .)
222+
}
223+
}
224+
PAYLOAD

0 commit comments

Comments
 (0)