Skip to content

Commit d45a0e6

Browse files
authored
Merge pull request #182 from bobbrodie/7.0.x
Use jq to build JSON
2 parents b59395b + ff3edc1 commit d45a0e6

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,31 @@ jobs:
4343
- name: Extract release data
4444
id: release
4545
run: |
46-
echo "title=$(echo "${{ github.event.release.name }}" | sed 's/"/\\"/g')" >> $GITHUB_OUTPUT
47-
echo "body=$(echo "${{ github.event.release.body }}" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g')" >> $GITHUB_OUTPUT
46+
echo "title=${{ github.event.release.name }}" >> $GITHUB_OUTPUT
47+
{
48+
echo "body<<EOF"
49+
echo "${{ github.event.release.body }}"
50+
echo "EOF"
51+
} >> $GITHUB_OUTPUT
52+
53+
- name: Install jq
54+
run: sudo apt-get update && sudo apt-get install -y jq
4855

4956
- name: Publish changelog to Readme
5057
env:
5158
README_API_KEY: ${{ secrets.README_API_KEY }}
5259
run: |
60+
jq -n --arg title "Python Unified SDK ${{ steps.release.outputs.title }}" \
61+
--arg body "${{ steps.release.outputs.body }}" \
62+
'{
63+
title: $title,
64+
content: {
65+
body: $body
66+
},
67+
privacy: { view: "public" }
68+
}' > payload.json
69+
5370
curl --location 'https://api.readme.com/v2/changelogs' \
54-
--header "Authorization: Bearer $README_API_KEY" \
55-
--header 'Content-Type: application/json' \
56-
--data '{
57-
"body": "${{ steps.release.outputs.body }}",
58-
"title": "Python Unified SDK ${{ steps.release.outputs.title }}",
59-
"privacy": {
60-
"view": "public"
61-
}
62-
}'
71+
--header "Authorization: Bearer $README_API_KEY" \
72+
--header 'Content-Type: application/json' \
73+
--data @payload.json

0 commit comments

Comments
 (0)