Skip to content

Test/discord testing#470

Closed
imAaryash wants to merge 3 commits intosiddharthvaddem:mainfrom
imAaryash:test/discord-testing
Closed

Test/discord testing#470
imAaryash wants to merge 3 commits intosiddharthvaddem:mainfrom
imAaryash:test/discord-testing

Conversation

@imAaryash
Copy link
Copy Markdown
Collaborator

@imAaryash imAaryash commented Apr 19, 2026

Pull Request Template

Description

Motivation

Type of Change

  • New Feature
  • Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Related Issue(s)

Screenshots / Video

Screenshot (if applicable):

![Screenshot Description](path/to/screenshot.png)

Video (if applicable):

<video src="path/to/video.mp4" controls width="600"></video>

Testing

Checklist

  • I have performed a self-review of my code.
  • I have added any necessary screenshots or videos.
  • I have linked related issue(s) and updated the changelog if applicable.

Thank you for contributing!

Summary by CodeRabbit

  • Documentation
    • Updated Discord community invite link in README.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 19, 2026

📝 Walkthrough

Walkthrough

Updates Discord webhook response handling to parse JSON conditionally based on content-type, read error text upfront, and relax secret validation to only fail on specific event types (pull_request_target, workflow_dispatch) instead of all events. Also updates Discord invite link in README.

Changes

Cohort / File(s) Summary
Discord Workflow Updates
.github/workflows/discord.yaml
Improved webhook response handling: captures response text and content-type upfront, throws on non-2xx with captured text, conditionally parses JSON only when content-type indicates application/json (logs warning and returns {} otherwise). Relaxed secret validation: now only fails for pull_request_target and workflow_dispatch events; other events emit warning and skip instead.
Discord Link Update
README.md
Updated Discord invite link from yAQQhRaEeg to 8552rJwVRX in the badge hyperlink.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • siddharthvaddem

Poem

🔗 webhooks at dawn, secrets now selective,
json parsed with care, content-type directive,
errors caught in text before the parse,
discord links renewed, workflow's got class ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is just the empty template with no concrete information filled in—all sections contain only placeholder comments. Fill in the template sections with actual details: describe what changed, why it matters, what type of change it is, testing steps, and any related issues.
Title check ❓ Inconclusive The title 'Test/discord testing' is vague and doesn't clearly convey the actual changes—updating Discord link and refactoring error handling. Use a more specific title like 'Update Discord link and refactor webhook error handling' that describes the actual changes.
✅ Passed checks (1 passed)
Check name Status Explanation
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.


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
Contributor

@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

🤖 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/discord.yaml:
- Around line 212-223: The set strictEvents currently includes
"workflow_dispatch" which is dead here because getPullRequest()/pr-check runs
earlier; remove "workflow_dispatch" from the strictEvents Set (where
strictEvents is defined and used with context.eventName) so only events that can
reach this branch (e.g., "pull_request_target") will call core.setFailed, or
alternatively move this webhook-missing early-fail logic before the
getPullRequest()/pr check if your intent is to fail on manual workflow_dispatch
runs—pick one approach and apply it to the block that defines/uses strictEvents
and the subsequent core.setFailed/core.warning calls.
🪄 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: 538a9943-217f-45ea-be67-87530f6a2206

📥 Commits

Reviewing files that changed from the base of the PR and between fd6a077 and c7e6ccf.

📒 Files selected for processing (2)
  • .github/workflows/discord.yaml
  • README.md

Comment on lines 212 to 223
if (!webhookUrl) {
core.setFailed(
"Missing Discord webhook secret. Set either DISCORD_WEBHOOK_URL or DISCORD_PR_FORUM_WEBHOOK in repository secrets, or pass it explicitly if using reusable workflows."
);
const strictEvents = new Set(["pull_request_target", "workflow_dispatch"]);
const msg =
`Discord sync skipped: webhook secret unavailable for event '${context.eventName}'. ` +
"Set either DISCORD_WEBHOOK_URL or DISCORD_PR_FORUM_WEBHOOK in repository secrets.";
if (strictEvents.has(context.eventName)) {
core.setFailed(msg);
} else {
core.warning(msg);
}
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

nit: workflow_dispatch in strictEvents is effectively dead code

getPullRequest() only returns a PR for pull_request_target, pull_request_review, and issue_comment. For workflow_dispatch it returns null, so we bail at the if (!pr) check on line 207-210 before ever reaching this webhook-missing branch. So in practice only pull_request_target can ever trigger setFailed here — workflow_dispatch will never hit it.

not a bug, just kinda misleading. either drop workflow_dispatch from the set, or (if the intent was "fail loudly on manual runs with misconfig") move a similar check earlier so it actually fires. totally fine to leave as-is too, just flagging.

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

In @.github/workflows/discord.yaml around lines 212 - 223, The set strictEvents
currently includes "workflow_dispatch" which is dead here because
getPullRequest()/pr-check runs earlier; remove "workflow_dispatch" from the
strictEvents Set (where strictEvents is defined and used with context.eventName)
so only events that can reach this branch (e.g., "pull_request_target") will
call core.setFailed, or alternatively move this webhook-missing early-fail logic
before the getPullRequest()/pr check if your intent is to fail on manual
workflow_dispatch runs—pick one approach and apply it to the block that
defines/uses strictEvents and the subsequent core.setFailed/core.warning calls.

@imAaryash imAaryash closed this Apr 19, 2026
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