Skip to content

chore: make a post on discord on every release#1330

Open
sansyrox wants to merge 2 commits intomainfrom
discord/releases
Open

chore: make a post on discord on every release#1330
sansyrox wants to merge 2 commits intomainfrom
discord/releases

Conversation

@sansyrox
Copy link
Copy Markdown
Member

@sansyrox sansyrox commented Mar 15, 2026

Description

This PR fixes #

Summary

This PR does....

PR Checklist

Please ensure that:

  • The PR contains a descriptive title
  • The PR contains a descriptive summary of the changes
  • You build and test your changes before submitting a PR.
  • You have added relevant documentation
  • You have added relevant tests. We prefer integration tests wherever possible

Pre-Commit Instructions:

Summary by CodeRabbit

  • New Features
    • Added automated Discord release notifications sent for tagged releases. Notifications include the new version, a curated changelog, upgrade instructions, and a link to the release; they trigger only for version tag releases and run after a successful release process.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
robyn Ready Ready Preview, Comment Mar 28, 2026 8:07pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 15, 2026

📝 Walkthrough

Walkthrough

Adds a GitHub Actions job that runs after a successful release, computes the release version and changelog from git, formats a multi-line message, JSON-encodes it, and posts it to a Discord webhook.

Changes

Cohort / File(s) Summary
Discord Release Notification Job
\.github/workflows/release-CI.yml
Added discord-notify job that depends on release, extracts VERSION from GITHUB_REF, finds previous tag or recent commits for a CHANGELOG, filters out - Release entries, builds a JSON payload, and POSTs it to DISCORD_WEBHOOK_URL via curl.

Sequence Diagram(s)

sequenceDiagram
  participant GH as "GitHub Actions (runner)"
  participant Git as "git (repo)"
  participant Discord as "Discord Webhook (external)"

  rect rgba(135,206,235,0.5)
  GH->>Git: checkout (fetch-depth:0) and read GITHUB_REF
  Git-->>GH: tags, commits
  end

  rect rgba(144,238,144,0.5)
  GH->>GH: compute VERSION, determine PREV_TAG or last 20 commits\ngenerate CHANGELOG (exclude '- Release ' lines)
  end

  rect rgba(255,182,193,0.5)
  GH->>Discord: POST JSON payload (version, changelog, upgrade cmd, release URL)
  Discord-->>GH: 2xx/4xx response
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I dug through tags and logs tonight,
to craft a changelog soft and bright,
then wrapped it up in JSON cheer,
and sent it hopping far and near,
Discord feasted—release delight! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description contains only template placeholder content with no actual details about the specific changes made. Replace placeholder text with specific details about the Discord notification feature, including what triggered the change and implementation details.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Discord notifications for releases.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch discord/releases

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/release-CI.yml (2)

235-239: Good use of jq for JSON encoding and curl -f for error detection.

Using jq properly handles special characters and newlines in the message. The -f flag ensures the step fails on HTTP errors.

Consider adding -sS flags to suppress progress output while still showing errors:

♻️ Suggested improvement
-          curl -f -H "Content-Type: application/json" \
+          curl -fsSL -H "Content-Type: application/json" \
             -d "$PAYLOAD" \
             "$DISCORD_WEBHOOK_URL"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-CI.yml around lines 235 - 239, The curl invocation
that posts PAYLOAD to $DISCORD_WEBHOOK_URL should include the silent-with-errors
flags so progress output is suppressed but errors are still shown; update the
curl command that currently uses -f to add -sS (i.e., combine with -f) when
sending the -d "$PAYLOAD" for the MESSAGE to keep logs clean while preserving
failure detection.

212-214: Consider using actions/checkout@v4.

Static analysis flags actions/checkout@v3 as outdated. While this is consistent with other checkout actions in the file, you may want to update to v4 for the new job (and consider updating the others in a separate PR).

♻️ Suggested update
       - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           fetch-depth: 0
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-CI.yml around lines 212 - 214, Update the checkout
step that currently uses actions/checkout@v3 to actions/checkout@v4; locate the
job step where the YAML contains "uses: actions/checkout@v3" and change the
version string to "@v4" (leave the with: fetch-depth: 0 intact), and consider
leaving a comment or note if you plan to update other checkout usages in
separate PRs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/release-CI.yml:
- Around line 219-221: Validate and guard the tag extraction and log range:
ensure VERSION is only set from GITHUB_REF when it starts with "refs/tags/v"
(otherwise derive a fallback like the latest tag via git describe --tags
--abbrev=0 or a default), make PREV_TAG assignment robust by falling back when
no second tag exists (e.g., set PREV_TAG to the repository root commit via git
rev-list --max-parents=0 HEAD or leave it empty but handle that case), and when
computing CHANGELOG use a safe git log range (if PREV_TAG is empty use git log
--pretty=format:"- %s" --no-merges HEAD or use "${PREV_TAG}..HEAD" only when
PREV_TAG is non-empty) so VERSION, PREV_TAG and CHANGELOG commands handle
first-release and manual workflow_dispatch scenarios without failing.

---

Nitpick comments:
In @.github/workflows/release-CI.yml:
- Around line 235-239: The curl invocation that posts PAYLOAD to
$DISCORD_WEBHOOK_URL should include the silent-with-errors flags so progress
output is suppressed but errors are still shown; update the curl command that
currently uses -f to add -sS (i.e., combine with -f) when sending the -d
"$PAYLOAD" for the MESSAGE to keep logs clean while preserving failure
detection.
- Around line 212-214: Update the checkout step that currently uses
actions/checkout@v3 to actions/checkout@v4; locate the job step where the YAML
contains "uses: actions/checkout@v3" and change the version string to "@v4"
(leave the with: fetch-depth: 0 intact), and consider leaving a comment or note
if you plan to update other checkout usages in separate PRs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 24e81fd7-2f64-4929-bafa-cdf58c1fc127

📥 Commits

Reviewing files that changed from the base of the PR and between 4a2104d and 3f40bb8.

📒 Files selected for processing (1)
  • .github/workflows/release-CI.yml

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 15, 2026

Merging this PR will not alter performance

✅ 189 untouched benchmarks


Comparing discord/releases (3ad43e6) with main (3e04c65)

Open in CodSpeed

- Skip notification when GITHUB_REF is not a tag (e.g. workflow_dispatch)
  to avoid producing a nonsensical version string
- Fall back to last 20 commits when PREV_TAG is empty (first release)
  to avoid git log failing on an invalid "..HEAD" range

Made-with: Cursor
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
.github/workflows/release-CI.yml (2)

212-214: Update actions/checkout to v4.

The static analysis tool flags actions/checkout@v3 as outdated. Version 3 uses Node.js 16, which GitHub has been deprecating. Since this is new code, prefer actions/checkout@v4 which uses Node.js 20.

♻️ Proposed fix
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4

Note: The existing checkout actions elsewhere in this workflow (lines 24, 59, 89, 126) also use v3 and could be updated in a separate PR.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-CI.yml around lines 212 - 214, Replace uses:
actions/checkout@v3 with uses: actions/checkout@v4 in the workflow steps that
currently call actions/checkout (the occurrences that include the fetch-depth: 0
option), ensuring you only change the version string to v4 and preserve existing
inputs like fetch-depth; update each checkout step in this file to v4 so the
action runs on Node.js 20.

247-249: Consider adding a timeout to prevent indefinite hangs.

While unlikely for Discord webhooks, adding a timeout ensures the job fails gracefully if the endpoint is unresponsive.

♻️ Proposed fix
-          curl -f -H "Content-Type: application/json" \
+          curl -f --max-time 30 -H "Content-Type: application/json" \
             -d "$PAYLOAD" \
             "$DISCORD_WEBHOOK_URL"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-CI.yml around lines 247 - 249, Add a timeout to
the curl call that posts $PAYLOAD to $DISCORD_WEBHOOK_URL to avoid indefinite
hangs: update the curl invocation (the lines using curl -f -H "Content-Type:
application/json" -d "$PAYLOAD" "$DISCORD_WEBHOOK_URL") to include connection
and overall timeouts (e.g. --connect-timeout and --max-time) so the step fails
fast if Discord is unresponsive; keep -f so curl still returns a non-zero exit
code on HTTP errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/release-CI.yml:
- Around line 212-214: Replace uses: actions/checkout@v3 with uses:
actions/checkout@v4 in the workflow steps that currently call actions/checkout
(the occurrences that include the fetch-depth: 0 option), ensuring you only
change the version string to v4 and preserve existing inputs like fetch-depth;
update each checkout step in this file to v4 so the action runs on Node.js 20.
- Around line 247-249: Add a timeout to the curl call that posts $PAYLOAD to
$DISCORD_WEBHOOK_URL to avoid indefinite hangs: update the curl invocation (the
lines using curl -f -H "Content-Type: application/json" -d "$PAYLOAD"
"$DISCORD_WEBHOOK_URL") to include connection and overall timeouts (e.g.
--connect-timeout and --max-time) so the step fails fast if Discord is
unresponsive; keep -f so curl still returns a non-zero exit code on HTTP errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7ef217b8-f7e8-44cb-a744-200cdfc537ff

📥 Commits

Reviewing files that changed from the base of the PR and between 3f40bb8 and 3ad43e6.

📒 Files selected for processing (1)
  • .github/workflows/release-CI.yml

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