Repository navigation
ci: workflow results → Discord - #1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0dcec31f1e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| echo "::warning::DISCORD_RELEASE_WEBHOOK not set — result not posted." | ||
| exit 0 | ||
| fi | ||
| jq -n --arg c "$MSG" '{content:$c, flags:4}' \ |
There was a problem hiding this comment.
Disable mentions in webhook payloads
When a failed run comes from a pull request, MSG includes the contributor-controlled display_title; because this payload omits allowed_mentions, a title containing @everyone, @here, or a Discord mention can trigger notifications in the channel. The existing flags:4 only suppresses embeds, so set allowed_mentions to an empty parse list before forwarding untrusted run metadata.
Useful? React with 👍 / 👎.
| exit 0 | ||
| fi | ||
| jq -n --arg c "$MSG" '{content:$c, flags:4}' \ | ||
| | curl -sS -o /dev/null -w 'discord %{http_code}\n' -X POST -H 'Content-Type: application/json' -d @- "$WEBHOOK" |
There was a problem hiding this comment.
Reject failed Discord responses
When the webhook is expired, misconfigured, rate-limited, or rejects the payload, Discord can return an HTTP 4xx/5xx response while this curl invocation still exits successfully, so the reporter remains green even though the notification was lost. curl --help all defines --fail as “Fail fast with no output on HTTP errors”; add HTTP-status validation and, for transient failures such as 429, retry handling.
Useful? React with 👍 / 👎.
workflow_run catch-all posting CI + Release results to #ci_notifications (same pattern as the clients/backend repos). PR runs post only on failure. DISCORD_RELEASE_WEBHOOK secret set.
🤖 Generated with Claude Code