File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 88jobs :
99 announce :
1010 runs-on : ubuntu-latest
11+
1112 steps :
12- - uses : actions/checkout@v3
13+ - name : Checkout repository
14+ uses : actions/checkout@v3
1315
14- - name : Post to Discord
16+ - name : Post release to Discord
1517 run : |
16- TAG=${GITHUB_REF#refs/tags/} # e.g., v4.0.8
17- VERSION=${TAG#v} # remove 'v' to match CHANGELOG.md headers
18+ TAG=${GITHUB_REF#refs/tags/} # e.g., v4.0.8
19+ VERSION=${TAG#v} # remove 'v' to match changelog headers
1820
19- # extract lines under version header until next '##'
21+ # Extract changelog block for this version
2022 NOTES=$(sed -n "/^## $VERSION$/,/^## /{ /^## /!p }" CHANGELOG.md | sed '/^[[:space:]]*$/d')
2123
22- # fallback if nothing found
2324 if [ -z "$NOTES" ]; then
2425 NOTES="(no changelog entry found for $VERSION)"
2526 fi
2627
27- # construct JSON safely with jq
28- PAYLOAD=$(jq -n --arg content "📦 **New fetch-kit Release: $TAG**\nRepository: $GITHUB_REPOSITORY\n\`\`\`\n$ NOTES\n\`\`\` " \
29- '{content: $content }')
28+ # Construct JSON with jq, preserving literal line breaks
29+ PAYLOAD=$(jq -Rn --arg tag "$TAG" --arg repo "$GITHUB_REPOSITORY" --arg notes "$ NOTES" \
30+ '{content: ("📦 **New fetch-kit Release: \($tag)**\nRepository: \($repo)\n```\n\($notes)\n```") }')
3031
32+ # Send to Discord webhook
3133 curl -sS -H "Content-Type: application/json" -X POST -d "$PAYLOAD" ${{ secrets.DISCORD_WEBHOOK }}
You can’t perform that action at this time.
0 commit comments