fix(ci): stop Discord discussions notifier from posting blank bot comments#1185
Conversation
…ments Apply the same fix as rocketride-org#1080 (PRs/issues) to discord-discussions.yml, which was missed in that change. Store the discord-msg-id marker inside a collapsible <details> block instead of a bare HTML comment, so the tracking comment no longer renders as an empty github-actions[bot] comment on every discussion. Relax the marker-detection regex to match anywhere, keeping backward compatibility with existing bare-marker comments. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdd a shared ChangesDiscord marker handling and helper
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🤖 Internal: Discord sync markerAuto-managed by the Discord notification workflow. Stores the linked Discord message ID. Do not edit or delete. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/discord-discussions.yml:
- Line 191: The Discord HTML marker regex test("<!-- discord-msg-id:[0-9]+ -->")
is duplicated across workflows (.github/workflows/discord-discussions.yml and
.github/workflows/discord-pr.yml); centralize the marker contract by moving
marker rendering and extraction into a single script or action (e.g.,
.github/workflows/scripts/discord-helper.sh) and replace the inline regex/tests
and payload generation in both workflows with calls to that helper; ensure the
helper exposes clear functions (e.g., render_discord_marker,
extract_discord_marker) and update the workflows to use those names so future
changes to the marker (the <!-- discord-msg-id:... --> pattern and corresponding
<details> payload) are made in one place only.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: ff7bdc20-ab1c-44d0-82e5-54e35fb57c33
📒 Files selected for processing (1)
.github/workflows/discord-discussions.yml
…er.sh The marker format (the <!-- discord-msg-id:N --> pattern, its <details> payload, and the ID extraction) was duplicated across discord-pr.yml, discord-issues.yml, and discord-discussions.yml — which is why the rocketride-org#1080 blank-comment fix had to be re-applied to discussions separately. Move the contract into the already-shared discord-helper.sh: - DISCORD_MARKER_PATTERN — the jq test() regex (passed via --arg) - render_discord_marker — emits the <details>-wrapped comment body - extract_discord_marker — reads a body on stdin, prints the message ID All three workflows now call these helpers, so future marker changes happen in one place. Race-guard lookups switch from `gh api --jq` to `gh api | jq --arg` (gh's --jq can't take --arg); behavior under `bash -e` is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/scripts/discord-helper.sh:
- Around line 109-110: The regex in extract_discord_marker is too permissive:
update the pattern in the extract_discord_marker function so it requires
one-or-more digits (not zero-or-more) to avoid returning an empty ID; either
switch grep to use extended regex with grep -oE 'discord-msg-id:[0-9]+' or keep
basic grep and use the BRE form 'discord-msg-id:[0-9]\+' before piping to cut
and head -n1 so it matches only entries that contain at least one digit.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 405352cb-7241-4ecd-b687-e6b7f926cca1
📒 Files selected for processing (4)
.github/workflows/discord-discussions.yml.github/workflows/discord-issues.yml.github/workflows/discord-pr.yml.github/workflows/scripts/discord-helper.sh
…PATTERN Use grep -oE 'discord-msg-id:[0-9]+' so the extractor requires one-or-more digits, matching the [0-9]+ in DISCORD_MARKER_PATTERN. Keeps the centralized marker contract self-consistent (no behavioral change — digitless input still yields an empty ID). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Applies the same fix as #1080 to discord-discussions.yml, which was missed in that change. The discord-msg-id marker is now stored inside a collapsible
<details>block instead of a bare HTML comment, so it no longer renders as an empty github-actions[bot] comment on every discussion. The marker-detection regex is relaxed to match anywhere, keeping backward compatibility with existing bare-marker comments.Fixes #1184
Testing: YAML parses cleanly; change mirrors the already-merged PR/issue fix (
<details>wrapper + unanchored regex).Summary by CodeRabbit
Bug Fixes
New Features