Add Discord codebase digest workflow#1920
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a scheduled GitHub Actions workflow and a standalone Node.js script that gather recent GitHub activity, assemble merged-PR and direct-commit digests, and post them to a Discord webhook in daily and monthly-backfill modes. ChangesDiscord Codebase Digest
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 116 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Updated the workflow to use the Discord webhook's configured avatar instead of passing a website avatar URL in each payload. The existing |
|
Updated the webhook payload to set Discord's |
|
Updated the digest lines to include contributor attribution. Merged PR entries now use the PR author, and direct commit entries use the GitHub commit author when available, falling back to the raw commit author name. Example dry-run output: |
|
Added contributor attribution and simplified the date header. Digest lines now include |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
.github/workflows/discord-codebase-digest.yml (1)
34-36: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winAdd a job timeout for the network-heavy digest run.
Without
timeout-minutes, a stalled GitHub/Discord request can burn the default Actions timeout window.Proposed workflow guardrail
post-digest: name: Post daily Discord digest runs-on: ubuntu-latest + timeout-minutes: 10🤖 Prompt for 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. In @.github/workflows/discord-codebase-digest.yml around lines 34 - 36, Add an explicit timeout to the post-digest job so a stalled GitHub or Discord request does not consume the default runner window. Update the workflow job named post-digest in the discord-codebase-digest workflow by setting a reasonable timeout-minutes value alongside runs-on, and keep the rest of the job logic unchanged.
🤖 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/scripts/discord-codebase-digest.mjs:
- Line 3: The API_ROOT value is taken directly from GITHUB_API_URL before
githubJson adds the Authorization header, so validate that origin first. Update
discord-codebase-digest.mjs around API_ROOT and githubJson to allow only
GitHub/GHES hosts (or otherwise fail closed) before sending the token, and
ensure any requests to untrusted origins are blocked rather than authenticated.
- Around line 222-228: The PR lookup in fetchPullRequest currently swallows all
githubJson errors and returns null, which can misclassify PR-backed commits as
direct commits. Update fetchPullRequest to only return null for the known “not
found” case, using the existing fetchPullRequest/githubJson error handling path
to detect it, and rethrow or let all other errors fail the digest so merge
commits and bot/dependency updates are not silently treated as direct commits.
- Around line 202-217: The commit collection loop in discord-codebase-digest.mjs
is capped at 10 pages, which can silently drop commits after 1,000 results.
Update the pagination in the commit-fetching logic to keep requesting pages
until githubJson returns fewer than 100 items, or add a fail-closed guard that
throws when the 10-page limit is hit with a full page. Keep the fix localized to
the loop that uses page, pageItems, and all.
- Around line 94-96: The monthly backfill window is being computed with UTC
boundaries, which can shift commits near month edges into the wrong digest
month. Update monthStart and nextMonthStart in discord-codebase-digest.mjs to
use Australia/Melbourne-local midnight boundaries, and make sure the backfill
flow that builds the since/until range uses those Melbourne-aligned values
consistently.
In @.github/workflows/discord-codebase-digest.yml:
- Around line 39-40: The checkout step in the workflow currently leaves Git
credentials persisted, which is unnecessary for this read-only job. Update the
`Checkout repository` step that uses `actions/checkout` to explicitly disable
persisted credentials by setting `persist-credentials: false`, while leaving the
rest of the workflow unchanged since the Node script already uses `GITHUB_TOKEN`
directly.
---
Nitpick comments:
In @.github/workflows/discord-codebase-digest.yml:
- Around line 34-36: Add an explicit timeout to the post-digest job so a stalled
GitHub or Discord request does not consume the default runner window. Update the
workflow job named post-digest in the discord-codebase-digest workflow by
setting a reasonable timeout-minutes value alongside runs-on, and keep the rest
of the job logic unchanged.
🪄 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: CHILL
Plan: Pro Plus
Run ID: a4c3addc-bf93-4605-b870-8b21016c1598
📒 Files selected for processing (2)
.github/scripts/discord-codebase-digest.mjs.github/workflows/discord-codebase-digest.yml
Summary
Adds a daily Discord codebase digest for the Maester repo.
GITHUB_TOKENwith read-only contents/pull-request permissionsDiscord setup
The
#codebase-updatesDiscord channel andMaester botwebhook have been created, andDISCORD_CODEBASE_WEBHOOK_URLhas been saved as a GitHub Actions secret formaester365/maester.Validation
node --check .github/scripts/discord-codebase-digest.mjsDIGEST_DRY_RUN=true DIGEST_SINCE_HOURS=72#codebase-updatesverified the webhook posts asMaester botwith no user or role mentionsSummary by CodeRabbit