Skip to content

Commit 43e2df8

Browse files
committed
Workflow : Updated discord release hook
1 parent eda6bb2 commit 43e2df8

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
11
name: Discord Release Notifier
22

3-
# This action will only trigger when a new release is "published".
4-
# It won't trigger on drafts or pre-releases.
53
on:
64
release:
75
types: [published]
86

97
jobs:
108
notify:
11-
name: Send Discord Notification
129
runs-on: ubuntu-latest
1310
steps:
1411
- name: Send Release Info to Discord
1512
env:
16-
# We securely access the webhook URL from the GitHub secret we created.
1713
DISCORD_WEBHOOK_URL_1: ${{ secrets.DISCORD_WEBHOOK_URL_1 }}
1814
run: |
19-
# This command uses `curl` to send a POST request with a JSON payload.
20-
# The JSON creates a nice-looking "embed" in Discord.
15+
# Truncate release notes to avoid Discord limit (4000 chars safe)
16+
BODY=$(echo "${{ github.event.release.body }}" | head -c 4000)
17+
2118
curl -X POST "$DISCORD_WEBHOOK_URL_1" \
22-
-H "Content-Type: application/json" \
23-
-d @- << EOF
19+
-H "Content-Type: application/json" \
20+
-d @- << EOF
2421
{
25-
"username": "Github Releases",
22+
"username": "GitHub Releases",
2623
"avatar_url": "https://github.com/github.png",
2724
"embeds": [
2825
{
2926
"title": "🚀 New Release: ${{ github.event.release.name }}",
3027
"url": "${{ github.event.release.html_url }}",
31-
"description": "${{ github.event.release.body }}",
28+
"description": "$BODY\n\n🔗 **Read full changelog on GitHub**",
3229
"color": 5814783,
3330
"author": {
3431
"name": "${{ github.event.release.author.login }}",
@@ -41,4 +38,4 @@ jobs:
4138
}
4239
]
4340
}
44-
EOF
41+
EOF

0 commit comments

Comments
 (0)