Skip to content

fix(ci): stop Discord discussions notifier from posting blank bot comments#1185

Open
mithileshgau wants to merge 3 commits into
rocketride-org:developfrom
mithileshgau:fix/RR-1184-discord-discussions-blank-comments
Open

fix(ci): stop Discord discussions notifier from posting blank bot comments#1185
mithileshgau wants to merge 3 commits into
rocketride-org:developfrom
mithileshgau:fix/RR-1184-discord-discussions-blank-comments

Conversation

@mithileshgau

@mithileshgau mithileshgau commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

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

    • More reliable Discord↔GitHub comment sync: marker detection now finds markers anywhere in a comment, preventing missed matches and duplicate posts.
    • Improved duplicate/stale handling and race-guard logic so edits and concurrent posts update the correct Discord message instead of creating extras.
  • New Features

    • Comment bodies are consistently composed with an embedded marker format and centralized marker handling for robust cross-platform linking.

…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>
@mithileshgau mithileshgau requested a review from kwit75 as a code owner June 8, 2026 15:49
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Add a shared DISCORD_MARKER_PATTERN plus render_discord_marker and extract_discord_marker; update discussions, issues, and PR workflows to detect markers anywhere in comment bodies, extract stored Discord message IDs via the helper, and render visible <details>-wrapped marker comments for add/patch flows.

Changes

Discord marker handling and helper

Layer / File(s) Summary
Marker contract and helpers
.github/workflows/scripts/discord-helper.sh
Defines DISCORD_MARKER_PATTERN, render_discord_marker, and extract_discord_marker to serialize and parse the stored Discord message ID inside a <details> wrapper.
Discussions workflow marker handling
.github/workflows/discord-discussions.yml
Comment scan uses DISCORD_MARKER_PATTERN to find markers anywhere in .body; DISCORD_MSG_ID is extracted via extract_discord_marker; race-guard branches use extract_discord_marker, and new discussion comments are created with COMMENT_BODY from render_discord_marker.
Issues workflow marker handling
.github/workflows/discord-issues.yml
Existing-comment selection and stale-comment lookup use DISCORD_MARKER_PATTERN; POST race-guard deletes duplicate Discord posts when an existing marker-bearing comment is found, extracts stored IDs via extract_discord_marker, patches the message, or renders new comment body with render_discord_marker.
PR workflow marker handling
.github/workflows/discord-pr.yml
PR comment lookup, stale-comment selection, and race-guard duplicate detection now use DISCORD_MARKER_PATTERN; stored Discord IDs are derived with extract_discord_marker, and new stored-marker comments are composed with render_discord_marker.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

builder

Suggested reviewers

  • kwit75
  • anandray
  • stepmikhaylov

Poem

🐰 I hid a marker in the hay,
Found it now the proper way,
Wrapped in details, plain to see,
No more blanks for you and me,
Hop—sync safe, and race-guarded play.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR successfully addresses issue #1184 by applying the marker-in-details wrapper fix to discord-discussions.yml and relaxing the marker detection regex for backward compatibility.
Out of Scope Changes check ✅ Passed All changes directly support the fix for #1184: refactoring marker detection/rendering in discord workflows and adding the shared helper functions in discord-helper.sh for consistency.
Title check ✅ Passed The title accurately describes the main fix: preventing blank bot comments in Discord discussions by wrapping markers in details tags and refactoring marker handling.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added the ci/cd CI/CD and build system label Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
🤖 Internal: Discord sync marker

Auto-managed by the Discord notification workflow. Stores the linked Discord message ID. Do not edit or delete.

@coderabbitai coderabbitai Bot left a comment

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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 368a826 and 4b4f763.

📒 Files selected for processing (1)
  • .github/workflows/discord-discussions.yml

Comment thread .github/workflows/discord-discussions.yml Outdated
…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>

@coderabbitai coderabbitai Bot left a comment

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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4b4f763 and 32819b6.

📒 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

Comment thread .github/workflows/scripts/discord-helper.sh Outdated
…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>
@mithileshgau mithileshgau changed the title fix(ci): stop Discord discussions notifier from posting blank bot com… fix(ci): stop Discord discussions notifier from posting blank bot comments Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builder ci/cd CI/CD and build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): Discord discussions notifier posts blank github-actions bot comments on every discussion

1 participant