Skip to content

Sanitize Discord webhook URL; don't fail release on Discord post#499

Merged
dsarno merged 1 commit into
mainfrom
fix/discord-webhook-sanitize
May 30, 2026
Merged

Sanitize Discord webhook URL; don't fail release on Discord post#499
dsarno merged 1 commit into
mainfrom
fix/discord-webhook-sanitize

Conversation

@dsarno

@dsarno dsarno commented May 30, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the changelog-to-Discord step that failed on its first real release with:

curl: (3) URL rejected: Malformed input to a URL function

Cause

The DISCORD_CHANGELOG_WEBHOOK secret carries a trailing newlinegh secret set keeps it when the value is pasted/piped with a newline. curl rejects the resulting URL as malformed. (Our local smoke test wrote the URL with printf '%s', no newline, so it worked — the secret didn't get that treatment.)

Fix

  • Strip all whitespace from the webhook value before use. A webhook URL has no internal whitespace, so this is safe and repairs the already-contaminated secret without needing it re-set.
  • Make the post non-fatal: the release ships before this step runs, so a Discord failure now logs a ::warning:: annotation and exits 0 instead of turning a green release red. Adds curl --retry 3 for transient blips.

Note

The release that surfaced this (the run linked from the failure) shipped fine — only the changelog post was skipped. That one version's note can be posted manually if desired; all future releases post automatically once this merges.

🤖 Generated with Claude Code

The first real release post failed with `curl: (3) URL rejected: Malformed
input to a URL function` — the DISCORD_CHANGELOG_WEBHOOK secret carries a
trailing newline (captured by `gh secret set` when the value is pasted/piped
with one), which curl rejects as a malformed URL.

- Strip all whitespace from the webhook value before use. A webhook URL has
  no internal whitespace, so this is safe and repairs the contaminated
  secret without needing it re-set.
- Make the post non-fatal: the release already shipped before this step, so
  a Discord failure now logs a ::warning:: annotation and exits 0 instead of
  turning a successful release red. Also adds curl --retry for transient
  network blips.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dsarno dsarno force-pushed the fix/discord-webhook-sanitize branch from 5e71d2c to 177143b Compare May 30, 2026 21:42
@codecov

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@dsarno dsarno merged commit 5b62c41 into main May 30, 2026
15 checks passed
@dsarno dsarno deleted the fix/discord-webhook-sanitize branch May 30, 2026 21:54
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