Skip to content

Commit 3133863

Browse files
dsarnoclaude
andauthored
Post silent changelog to Discord on release (#493)
Adds a step to release.yml that posts each new release's auto-generated notes to the project Discord's #changelog channel via a channel-scoped webhook (secret DISCORD_CHANGELOG_WEBHOOK). The post is silent: flags:4096 (Discord's SUPPRESS_NOTIFICATIONS / @silent) means the message lands in the channel and marks it unread but triggers no push/desktop notification for anyone, independent of per-channel settings. No @everyone/@here is ever included, and allowed_mentions.parse:[] is belt-and-suspenders against any @mention in the notes pinging. The step skips cleanly when the secret is unset, so releases never break. In-line in release.yml rather than a release:published-triggered workflow because the GITHUB_TOKEN-created release won't fire downstream workflows (GitHub anti-loop safeguard) — same reason bump-and-release dispatches release.yml explicitly. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e22f938 commit 3133863

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,48 @@ jobs:
166166
with:
167167
files: godot-ai-plugin.zip
168168
generate_release_notes: true
169+
170+
- name: Post changelog to Discord
171+
# Posts the release's auto-generated notes to the #changelog channel
172+
# via a channel-scoped webhook. Skips cleanly when the webhook secret
173+
# isn't configured, so releases never break if it's unset/removed.
174+
#
175+
# The post is silent: flags:4096 is Discord's SUPPRESS_NOTIFICATIONS
176+
# (the @silent mechanism) — the message lands in the channel and marks
177+
# it unread, but triggers NO push/desktop notification for anyone,
178+
# regardless of their per-channel notification settings. The generated
179+
# notes never contain @everyone/@here, and allowed_mentions.parse:[] is
180+
# belt-and-suspenders against any @mention in the notes ever pinging.
181+
env:
182+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_CHANGELOG_WEBHOOK }}
183+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
184+
run: |
185+
if [ -z "$DISCORD_WEBHOOK" ]; then
186+
echo "DISCORD_CHANGELOG_WEBHOOK not set — skipping changelog post."
187+
exit 0
188+
fi
189+
tag="$GITHUB_REF_NAME"
190+
name=$(gh release view "$tag" --json name --jq '.name')
191+
url=$(gh release view "$tag" --json url --jq '.url')
192+
notes=$(gh release view "$tag" --json body --jq '.body')
193+
# Discord embed description caps at 4096 chars; leave headroom and
194+
# append a link line so the full notes are always one click away.
195+
desc=$(printf '%s' "$notes" | head -c 3900)
196+
payload=$(jq -n \
197+
--arg title "$name" \
198+
--arg url "$url" \
199+
--arg desc "$desc" \
200+
'{
201+
username: "Godot AI",
202+
allowed_mentions: { parse: [] },
203+
flags: 4096,
204+
embeds: [ {
205+
title: $title,
206+
url: $url,
207+
description: ($desc + "\n\n[View full release →](" + $url + ")"),
208+
color: 5793266
209+
} ]
210+
}')
211+
curl -fsS -H "Content-Type: application/json" \
212+
-X POST -d "$payload" "$DISCORD_WEBHOOK"
213+
echo "Posted changelog for $tag to Discord."

0 commit comments

Comments
 (0)