Skip to content

discord announcment on release#75

Open
Yan Xue (yanxue06) wants to merge 1 commit into
mainfrom
ENG-1316-Send-Message-On-Release
Open

discord announcment on release#75
Yan Xue (yanxue06) wants to merge 1 commit into
mainfrom
ENG-1316-Send-Message-On-Release

Conversation

@yanxue06
Copy link
Copy Markdown
Member

@yanxue06 Yan Xue (yanxue06) commented May 3, 2026


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Summary by CodeRabbit

  • New Features

    • Added a "Notify Discord" composite action to post release announcements to Discord via webhook. It supports service name, version, release URL, optional markdown notes, prerelease labeling, dry-run mode, and skips when no webhook is provided. Notes are truncated if too long.
  • Documentation

    • Added usage docs and examples for the Notify Discord block and its inputs.

Copilot AI review requested due to automatic review settings May 3, 2026 06:01
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

📝 Walkthrough

Walkthrough

Adds a new GitHub composite action .github/blocks/notify-discord/action.yaml and README docs to post release announcements as a Discord webhook embed; supports prerelease/dry-run flags, truncates release notes, no-ops when webhook URL is empty, and fails on HTTP errors or timeouts.

Changes

Discord Notification Action

Layer / File(s) Summary
Action Definition
.github/blocks/notify-discord/action.yaml (lines 1–30)
Composite action metadata and inputs: webhook-url, service-name, version, release-url, release-notes, prerelease, dry-run.
Wiring / Env
.github/blocks/notify-discord/action.yaml (lines 31–43)
Maps inputs into environment variables and runs an inline script via actions/github-script@v7.
Input Handling & Prep
.github/blocks/notify-discord/action.yaml (lines 45–64)
Reads env vars, treats empty WEBHOOK_URL as no-op, marks webhook as secret, converts flag strings to booleans, truncates release notes to a max length with ellipsis.
Payload Construction
.github/blocks/notify-discord/action.yaml (lines 65–79)
Builds a single Discord embed: optional [Pre-release] title prefix, embed color selection, title, URL, description, timestamp, and footer using repo context.
Dry-run Handling
.github/blocks/notify-discord/action.yaml (lines 81–85)
If dry-run is true, logs JSON payload and exits without sending a request.
Delivery & Error Handling
.github/blocks/notify-discord/action.yaml (lines 87–110)
Sends POST with Content-Type: application/json using fetch and a 10s AbortSignal.timeout; fails on timeout with a timeout-specific message; fails on non-OK responses including status and response body; logs success status on 2xx.
Documentation
README.md (lines 1276–1328)
Adds notify-discord block docs, input table, setup notes, no-op behavior when webhook-url is empty, and a usage example wiring it after create-github-release.

Sequence Diagram

sequenceDiagram
    participant GH as GitHub Workflow
    participant Action as Notify Discord Composite Action
    participant Discord as Discord Webhook

    GH->>Action: Invoke with inputs (webhook-url, service-name, version, release-url, release-notes, prerelease, dry-run)
    Note over Action: Read env vars, convert flags, truncate notes

    alt webhook-url empty
        Action->>Action: Log "Discord not configured" and exit (no-op)
    else webhook-url present
        Action->>Action: Build embed payload (add prerelease prefix if needed)
        alt dry-run true
            Action->>Action: Log payload JSON and exit
        else dry-run false
            Action->>Discord: POST embed JSON (10s timeout)
            alt HTTP 2xx
                Discord->>Action: 2xx response
                Action->>GH: Log success with status
            else timeout
                Action->>GH: Fail with timeout message
            else non-2xx
                Discord->>Action: Non-2xx + body
                Action->>GH: Fail with status and response body
            end
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped to send a tiny bell,
A release tale in one neat shell.
Notes trimmed to fit, a prerelease gleam,
Dry-run checks the payload's dream.
Webhook hops — and CI sings as well.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title refers to a real part of the changeset (Discord announcement functionality) but contains a typo ('announcment' instead of 'announcement') and is somewhat vague about the specific implementation—it doesn't clarify that this adds a new composite action block for posting release announcements to Discord.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 ENG-1316-Send-Message-On-Release

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value).


Review rate limit: 3/5 reviews remaining, refill in 15 minutes and 39 seconds.

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

📚 Skills documentation may need an update

This PR introduces changes that might not be reflected in the skills documentation.

Reason: The PR adds a new public BuildSpace block, notify-discord, with agent-relevant inputs and behavior, but _skills-repo/skills/buildspace-ci-cd/SKILL.md does not document that block or how to use it.

This is an automated check powered by AI. If the skills are intentionally unchanged, feel free to ignore this.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

📄 README may need an update

This PR introduces changes that might not be reflected in README.md.

Reason: README documents notify-discord, but it still misses existing reusable workflows/blocks like check-skills, dylib-release, makefile-dylib-release, bump-npm-version, go-build, and update-tap, and some documented workflow interfaces are wrong (for example go-service-release claims Linux ARM64/Windows builds and omits current inputs like tap-repo, tap-formula, publish-command, and use-blacksmith).

This is an automated check powered by AI. If the README is intentionally unchanged, feel free to ignore this.

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 (1)
README.md (1)

1278-1326: ⚡ Quick win

Add notify-discord to the Blocks table of contents.

The new section is present, but it is not linked from the existing Blocks nav, so readers have to scroll to find it. A single ToC entry would keep the docs discoverable.

📚 Suggested doc update
   - [comment-on-pr](`#comment-on-pr`)
+  - [notify-discord](`#notify-discord`)
   - [update-docs](`#update-docs`)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 1278 - 1326, Add a single TOC entry for the new
"notify-discord" block in the existing Blocks table of contents pointing to the
"notify-discord" section so readers can jump to its docs; update the README's
Blocks nav to include a link labeled notify-discord that targets the
notify-discord header (the section describing
.github/blocks/notify-discord/action.yaml).
🤖 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/blocks/notify-discord/action.yaml:
- Around line 87-91: The POST to Discord using fetch(webhookUrl, { ..., body:
JSON.stringify(payload) }) can hang indefinitely; wrap the request with an
AbortController-based timeout: create an AbortController, pass controller.signal
into the fetch options, start a setTimeout that calls controller.abort() after a
sensible timeout (e.g. 5–15s), clear the timer after the fetch completes, and
catch the abort/error to fail fast and log/throw appropriately; update the code
around the webhookUrl/payload/response fetch call to use this pattern so stalled
network calls don't pin the workflow.

---

Nitpick comments:
In `@README.md`:
- Around line 1278-1326: Add a single TOC entry for the new "notify-discord"
block in the existing Blocks table of contents pointing to the "notify-discord"
section so readers can jump to its docs; update the README's Blocks nav to
include a link labeled notify-discord that targets the notify-discord header
(the section describing .github/blocks/notify-discord/action.yaml).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b175ac56-dfc1-45e5-9ce8-8ee07d3789d3

📥 Commits

Reviewing files that changed from the base of the PR and between 55b2b4b and b463930.

📒 Files selected for processing (2)
  • .github/blocks/notify-discord/action.yaml
  • README.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Agent
  • GitHub Check: check-readme / check-readme
  • GitHub Check: check-skills / check-skills
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~1302-~1302: Do not mix variants of the same word (‘pre-release’ and ‘prerelease’) within a single text.
Context: ...the embed as a prerelease (amber color, [Pre-release] title prefix) | | dry-run | boolean...

(EN_WORD_COHERENCY)

Comment thread .github/blocks/notify-discord/action.yaml Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new reusable GitHub Actions “block” to announce releases to Discord via a webhook, and documents it in the repository README so it can be easily adopted in release workflows.

Changes:

  • Added a composite action block (notify-discord) that posts a Discord embed for a release (with prerelease styling, truncation, and dry-run support).
  • Updated README with setup, inputs, and usage example for the new block.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
README.md Documents the new notify-discord block (setup steps, inputs, usage snippet).
.github/blocks/notify-discord/action.yaml Implements the composite action that sends a release announcement to a Discord webhook.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread README.md Outdated
@yanxue06 Yan Xue (yanxue06) force-pushed the ENG-1316-Send-Message-On-Release branch from b463930 to 11511f4 Compare May 3, 2026 06:09
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Line 1302: Update the README entry for the `prerelease` input so the wording
is consistent: change the non-literal word “prerelease”/“pre-release” usage to
match one variant while keeping the literal Discord title prefix "[Pre-release]"
exactly as-is; specifically edit the description text for the `prerelease` input
to use the same hyphenation form throughout (e.g., "pre-release" or
"prerelease") and ensure the literal prefix remains "[Pre-release]".
- Around line 1307-1326: The example uses outputs from steps.release-info but
never defines that step; add a preceding step that runs the
generate-release-info block (use:
photon-hq/buildspace/.github/blocks/generate-release-info@main) with id
"release-info" and pass the required inputs (service-name, prerelease,
openai-api-key) so steps.release-info.outputs.version and
steps.release-info.outputs.release_notes are available for the "gh-release" and
"notify-discord" steps; ensure "gh-release" keeps id "gh-release" and
"notify-discord" uses steps.release-info outputs and
steps.gh-release.outputs.url as shown.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 921f330a-dc14-49e7-aaa9-719534b81f4c

📥 Commits

Reviewing files that changed from the base of the PR and between b463930 and 11511f4.

📒 Files selected for processing (2)
  • .github/blocks/notify-discord/action.yaml
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/blocks/notify-discord/action.yaml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: check-skills / check-skills
  • GitHub Check: check-readme / check-readme
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~1302-~1302: Do not mix variants of the same word (‘pre-release’ and ‘prerelease’) within a single text.
Context: ...the embed as a prerelease (amber color, [Pre-release] title prefix) | | dry-run | boolean...

(EN_WORD_COHERENCY)

Comment thread README.md
Comment thread README.md
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.

2 participants