Skip to content

fix(ci): truncate Discord commit field to avoid 400 on long messages#621

Merged
TomGrobbe merged 1 commit into
masterfrom
fix/discord-notification-payload
Jun 5, 2026
Merged

fix(ci): truncate Discord commit field to avoid 400 on long messages#621
TomGrobbe merged 1 commit into
masterfrom
fix/discord-notification-payload

Conversation

@TomGrobbe

Copy link
Copy Markdown
Owner

Problem

The Discord Notification job failed on the latest master CI/CD run (run 27018095845) with:

curl: (22) The requested URL returned error: 400

The build, release, and tag all succeeded (v3.8.14 published fine); only the notification step broke.

Root cause

The "Commit" embed field was built from the full commit message (github.event.head_commit.message). For the squash-merged commit 0df96a4, that message is 975 characters (it includes the entire PR body plus the co-author trailer). Combined with the [`sha`](commit_url) — link prefix (about 96 chars), the field value reached roughly 1071 characters, which exceeds Discord's 1024-character limit for embed field values. Discord rejects the payload with HTTP 400, and curl's -f flag turns that into exit code 22.

Fix

  • Use only the commit subject (first line) instead of the whole message.
  • Truncate it to 256 chars as a safety cap (with an ellipsis), so the payload can never exceed the limit.
  • Pass the message via the COMMIT_MSG environment variable instead of interpolating ${{ github.event.head_commit.message }} directly into the shell script. The previous direct interpolation would also break the script if a commit subject ever contained a double quote (a latent shell-injection / quoting bug).

No other steps were changed.

@TomGrobbe TomGrobbe merged commit 6ff0521 into master Jun 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant