Discord Webhook: Post New Builds to Your Server
A Discord webhook is a secret link that posts messages into one channel. Add it to the deploy Actions, and every new itch.io build announces itself:
🎮 New build live on itch.io:
ef6fe7d· https://yourname.itch.io/my-game
| Cost | Free |
| Needs a Bash API key? | ❌ No. The secret is in the webhook link itself, so Bash’s key system can’t attach it. It’s stored as a GitHub secret instead |
| Works with | deploy-itch.yml (live builds) and deploy-itch-preview.yml (preview builds) |
Part 1: Create the webhook
You need Manage Webhooks permission in the server.
- In Discord, open Server Settings → Integrations → Webhooks.
- Click New Webhook.
- Give it a name (like
itch.io deploys), an avatar if you want, and pick the channel (like#builds). - Click Copy Webhook URL. It looks like
https://discord.com/api/webhooks/123.../abc.... - Save Changes.
Anyone with that link can post in the channel. Never paste it into the Bash chat or commit it to the repo. If it leaks, delete the webhook and make a new one.
Part 2: Add it to GitHub
Repo → Settings → Secrets and variables → Actions → Secrets → New repository secret
| Name | Secret |
|---|---|
DISCORD_WEBHOOK_URL |
the webhook URL |
Part 3: The deploy Actions post on their own
Both deploy Actions in this repo already include a Post to Discord step. It only runs when
DISCORD_WEBHOOK_URL is set, so nothing changes until you add the secret.
The secret is read once for the whole job, and the step at the end looks like this:
env:
DISCORD_WEBHOOK_URL: $
steps:
# ... checkout, butler push, status ...
- name: Post to Discord
if: env.DISCORD_WEBHOOK_URL != ''
run: |
URL="https://$.itch.io/$"
MSG="🎮 **New build live on itch.io**: \`${GITHUB_SHA::7}\` · $URL"
jq -n --arg c "$MSG" '{content: $c, allowed_mentions: {parse: []}}' |
curl -sS --fail-with-body -H "Content-Type: application/json" -d @- "$DISCORD_WEBHOOK_URL"
allowed_mentions is empty so a commit message can never ping @everyone.
Optional: different channels for live and preview
Add a second webhook for a #previews channel, saved as the DISCORD_PREVIEW_WEBHOOK_URL secret.
The preview Action uses it if it’s set, and otherwise falls back to DISCORD_WEBHOOK_URL.
Troubleshooting
| Problem | Fix |
|---|---|
| No message after a deploy | Check the secret name is exactly DISCORD_WEBHOOK_URL, and the deploy itself succeeded. |
404 Unknown Webhook in the log |
The webhook was deleted. Make a new one and update the secret. |
401 / 403 |
The URL got cut off when copying. Copy it again. |
Checklist
- Webhook created in the right channel
DISCORD_WEBHOOK_URLGitHub secret added- Next
www/change posts a message
Links
- Discord: Intro to webhooks: https://support.discord.com/hc/en-us/articles/228383668