File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed
Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change 1- name : Announce Release on Discord
1+ name : Announce fetch-kit Release
22
33on :
44 push :
55 tags :
6- - ' v*'
6+ - ' v*.*.* '
77
88jobs :
99 announce :
1010 runs-on : ubuntu-latest
1111 steps :
12+ - uses : actions/checkout@v3
13+
1214 - name : Post to Discord
1315 run : |
14- payload=$(jq -n \
15- --arg content "New fetch-kit Release: $GITHUB_REF_NAME" \
16- '{content: $content}')
17- curl -X POST \
18- -H "Content-Type: application/json" \
19- -d "$payload" \
20- "${{ secrets.DISCORD_WEBHOOK }}"
16+ TAG=${GITHUB_REF#refs/tags/} # e.g., v4.0.8
17+ VERSION=${TAG#v} # remove 'v' to match CHANGELOG.md headers
18+
19+ # extract lines under version header until next '##'
20+ NOTES=$(sed -n "/^## $VERSION$/,/^## /{ /^## /!p }" CHANGELOG.md | sed '/^[[:space:]]*$/d')
21+
22+ # fallback if nothing found
23+ if [ -z "$NOTES" ]; then
24+ NOTES="(no changelog entry found for $VERSION)"
25+ fi
26+
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}')
30+
31+ 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