Skip to content

feat: Add PR review reminder workflow#1012

Open
Flashl3opard wants to merge 8 commits intoalphaonelabs:mainfrom
Flashl3opard:pr-review-reminder
Open

feat: Add PR review reminder workflow#1012
Flashl3opard wants to merge 8 commits intoalphaonelabs:mainfrom
Flashl3opard:pr-review-reminder

Conversation

@Flashl3opard
Copy link

@Flashl3opard Flashl3opard commented Mar 8, 2026

This PR implements a GitHub Action workflow that automatically notifies maintainers when a Pull Request has only been reviewed by CodeRabbit AI and no human review has occurred within 24 hours.

Features

  • Works immediately upon merge (no labels needed)
  • Detects PRs with only CodeRabbit reviews
  • Automatically notifies maintainers after configurable timeout (default: 24 hours)
  • Prevents duplicate notifications using comment tracking
  • Runs every 6 hours + on PR review events
  • Manual trigger option for testing

New Files

  • .github/workflows/pr-review-reminder.yml - Main workflow automation
  • .github/PR_REVIEW_REMINDER_SETUP.md - Setup documentation

Configuration

  • Maintainers: A1L13N
  • Time threshold: 24 hours (configurable)
  • Check frequency: Every 6 hours via cron
  • Tracking method: Hidden HTML comment markers (no labels required!)

🚀 How It Works

  1. Triggers:

    • When any PR review is submitted
    • Every 6 hours via scheduled cron job
    • Manual trigger from Actions tab
  2. For each open PR:

    • Checks if older than 24 hours
    • Verifies only CodeRabbit has reviewed/commented
    • Checks if already notified (via comment history)
  3. If all conditions met:

    • Posts comment mentioning maintainers
    • Requests reviews from maintainer list
    • Adds hidden tracking marker to prevent duplicates
  • Did you run the pre-commit? (If not, your PR will most likely not pass — please ensure it passes pre-commit)
  • Did you test the change? (Ensure you didn’t just prompt the AI and blindly commit — test the code and confirm it works)
  • Added screenshots to the PR description (if applicable)

Summary by CodeRabbit

  • New Features

    • Added an automated PR review reminder workflow that runs on schedule, on PR review events, or manually; configurable time threshold, notifies maintainers for PRs lacking human reviews/comments, and can request reviewers.
  • Documentation

    • Added comprehensive workflow documentation and a setup guide with configuration, examples, usage notes, a TL;DR, and quick links to relevant sections.

Copilot AI review requested due to automatic review settings March 8, 2026 13:48
@github-actions github-actions bot added the files-changed: 2 PR changes 2 files label Mar 8, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 8, 2026

Walkthrough

Adds a new "PR Review Reminder" GitHub Actions workflow and two documentation files. The workflow scans open PRs, aggregates human reviewers from reviews and comments, and posts maintainer notifications / review requests for PRs with only bot reviews older than a configurable threshold.

Changes

Cohort / File(s) Summary
Workflow
.github/workflows/pr-review-reminder.yml
New GitHub Actions workflow: triggers on review events, cron (every 6 hours) and manual dispatch; configurable hours threshold, maintainer list, exempt bots and notification marker; paginated open-PR listing; aggregates reviews, review comments, and issue comments; posts notification comment and requests reviews when only bots have reviewed.
PR Review Reminder Docs
.github/PR_REVIEW_REMINDER_SETUP.md
New setup/usage guide pointing to consolidated WORKFLOWS.md, quick links, TL;DR, configuration and testing instructions.
Workflows Index / Expanded Docs
.github/WORKFLOWS.md
Large documentation additions and restructuring: detailed PR Review Reminder section, expanded release notes examples, "Label Issues by Creation Date" workflow, and summaries for other workflows (Test, Pre-commit, CodeQL, Check Migrations).

Sequence Diagram(s)

sequenceDiagram
    participant GHEvents as GitHub Events
    participant Workflow as Actions Workflow
    participant API as GitHub API
    participant Maintainers as Maintainers

    GHEvents->>Workflow: Trigger (review / cron / manual)
    Workflow->>Workflow: Load config (MAINTAINERS, threshold, exempt bots, marker)
    Workflow->>API: List open PRs (paginated)
    API-->>Workflow: Return PR list
    loop per PR
        Workflow->>API: Fetch PR reviews
        API-->>Workflow: Reviews
        Workflow->>API: Fetch review comments & issue comments
        API-->>Workflow: Comments
        Workflow->>Workflow: Aggregate non-bot, non-author human reviewers
        alt No human reviewers AND PR age > threshold AND no existing marker
            Workflow->>API: Post comment mentioning maintainers + marker
            API-->>Workflow: Comment created
            Workflow->>API: Request reviews from maintainers (exclude author)
            API-->>Workflow: Review requests created / warnings if failed
        end
    end
    Workflow->>Workflow: Emit summary (checked / notified / errors)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: Add PR review reminder workflow' directly and concisely describes the main change: introducing a new GitHub Actions workflow for PR review reminders. It aligns with the primary objective and the substantial workflow implementation in the changeset.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
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: 6

🤖 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/PR_REVIEW_REMINDER_SETUP.md:
- Around line 31-43: The documentation references incorrect line numbers for the
workflow config; update the guidance in .github/PR_REVIEW_REMINDER_SETUP.md so
it points to the correct locations in .github/workflows/pr-review-reminder.yml:
change the MAINTAINERS reference from line 26 to line 27 and change the
DEFAULT_HOURS_THRESHOLD reference from line 29 to line 30, and adjust the
proposed fix block text accordingly so the MAINTAINERS and
DEFAULT_HOURS_THRESHOLD entries are pointed to the correct lines.

In @.github/workflows/pr-review-reminder.yml:
- Around line 71-76: The code makes duplicate calls to
github.rest.issues.listComments for the same PR (first populating issueComments
and later re-calling to build commenters); remove the second call and reuse the
first result (issueComments) everywhere you currently re-fetch comments
(including the logic that collects commenters at lines around the second call),
ensuring any downstream code references issueComments.data (or the same shape)
instead of making a new API request; adjust variable names if needed so
functions that currently expect the second-call response accept the original
issueComments variable.
- Around line 9-14: This workflow uses the pull_request_review trigger and can
run concurrently with peer-review-reminder.yml and
check-unresolved-conversations.yml, risking race conditions when posting
comments or requesting reviewers; add a GitHub Actions concurrency block (e.g.,
group: pr-review-workflows-${{ github.event.pull_request.number || github.run_id
}} and cancel-in-progress: false) at the top of this workflow to serialize
executions of pull_request_review-triggered workflows so API interactions are
not performed concurrently.
- Around line 136-142: The loop over allIssueComments may throw when
comment.body is null and miscounts bots as reviewers; update the logic where
allIssueComments.data.forEach(comment => ...) to first guard that comment.body
is a non-null string before calling comment.body.includes(notificationMarker),
and broaden bot filtering by checking the comment author is not a bot (use
comment.user.type === 'Bot' or filter logins that end with "[bot]" or a small
known-bot list) in addition to the existing comment.user.login !== pr.user.login
check before adding to allReviewers; ensure you reference allIssueComments,
comment.body, comment.user.login, notificationMarker, and allReviewers when
applying these guards.
- Around line 219-224: The current use of github.rest.pulls.list with per_page:
100 can miss PRs beyond the first page; replace the call with github.paginate to
iterate all pages (use github.paginate(github.rest.pulls.list, { owner:
context.repo.owner, repo: context.repo.repo, state: 'open', per_page: 100 }) or
equivalent) so you collect every open pull request, and update any variable
names like pulls to accept the aggregated array returned by paginate instead of
a single page response.
- Around line 119-147: The set allReviewers currently collects logins from
reviews.data, reviewComments.data and allIssueComments.data but only explicitly
deletes coderabbitBot; update the collection/filtering so all bot accounts are
excluded (e.g., any login that endsWith "[bot]" or matches a bot regex) before
logging and before final decisions; adjust logic around
allReviewers.delete(coderabbitBot) to instead perform a generic bot-filter step
using the same notificationMarker/pr.user.login checks so human reviewers remain
while dependabot[bot], github-actions[bot], etc., are removed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 384b09e2-9df7-40d1-b50b-0826f947f2d2

📥 Commits

Reviewing files that changed from the base of the PR and between c94caf8 and bbaff7d.

📒 Files selected for processing (2)
  • .github/PR_REVIEW_REMINDER_SETUP.md
  • .github/workflows/pr-review-reminder.yml

Copy link

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

This PR adds an automated GitHub Actions workflow (pr-review-reminder.yml) that monitors open PRs and notifies maintainers when a PR has been reviewed only by the CodeRabbit AI bot and no human review has occurred within 24 hours. It complements the existing peer-review-reminder.yml by targeting the specific scenario of AI-only reviews. A setup/documentation file is also included.

Changes:

  • New workflow file that runs on a 6-hour schedule, on PR review events, and on manual dispatch to detect and notify about PRs lacking human review
  • New setup documentation file explaining configuration, usage, and troubleshooting

Reviewed changes

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

File Description
.github/workflows/pr-review-reminder.yml Main workflow automation: fetches open PRs, checks for human reviewers, and posts reminder comments/review requests
.github/PR_REVIEW_REMINDER_SETUP.md Setup and usage documentation for the new workflow

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR has 3 unresolved review conversations. Please resolve them before this PR can be merged.

Copy link
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: 4

♻️ Duplicate comments (1)
.github/workflows/pr-review-reminder.yml (1)

151-152: ⚠️ Potential issue | 🟠 Major

Static bot exemptions still miss other automation accounts.

Removing only the logins listed in EXEMPT_BOTS means any new bot account is treated as a human reviewer and blocks notifications. Filter generic bot identities (user.type === 'Bot' or [bot] suffix) when collecting reviewers instead of relying solely on a hard-coded list.

Suggested fix
+                const isBotUser = (user) =>
+                  user &&
+                  (user.type === 'Bot' || (user.login && user.login.endsWith('[bot]')));
+
                 // Add review submitters
                 reviews.data.forEach(review => {
-                  if (review.user && review.user.login) {
+                  if (review.user && review.user.login && !isBotUser(review.user)) {
                     allReviewers.add(review.user.login);
                   }
                 });

                 // Add review comment authors
                 reviewComments.data.forEach(comment => {
-                  if (comment.user && comment.user.login) {
+                  if (comment.user && comment.user.login && !isBotUser(comment.user)) {
                     allReviewers.add(comment.user.login);
                   }
                 });
@@
-                  if (comment.user && comment.user.login &&
+                  if (comment.user && comment.user.login &&
+                      !isBotUser(comment.user) &&
                       comment.user.login !== pr.user.login &&
                       comment.body && !comment.body.includes(notificationMarker)) {
                     allReviewers.add(comment.user.login);
                   }
                 });
-
-                // Remove all bot accounts from the set
-                exemptBots.forEach(bot => allReviewers.delete(bot));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-review-reminder.yml around lines 151 - 152, When
removing exempt reviewers, also exclude generic automation accounts instead of
only using the hard-coded exemptBots list: when you build or prune allReviewers
(the block that currently calls exemptBots.forEach(bot =>
allReviewers.delete(bot))), iterate the reviewer identities and delete any whose
login indicates a bot (e.g., user.type === 'Bot' or login.endsWith('[bot]')) in
addition to deleting entries in exemptBots/EXEMPT_BOTS; this ensures both
explicit exemptions and any new GitHub App/bot accounts are filtered out.
🤖 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/pr-review-reminder.yml:
- Around line 178-187: The PR title sanitation currently only escapes markdown
characters (sanitizedTitle) but leaves `@mentions` intact, allowing pings; update
the sanitization of pr.title to also neutralize any '@' mentions before building
commentBody by replacing or inserting a zero-width character after the '@'
(e.g., transform '@' into '@' + zero-width-space) so usernames/teams no longer
resolve, and use that new neutralizedTitle wherever sanitizedTitle is used in
commentBody.
- Around line 58-62: The code currently parses input into hoursThreshold using
parseInt (variables input, hoursThreshold) but doesn't validate the result;
update the logic to validate that the parsed value is a finite integer > 0 (use
Number.isInteger(hoursThreshold) && hoursThreshold > 0 or Number.isFinite check)
and reject/stop the run if validation fails (e.g., set the workflow to failed or
exit with a clear error message referencing DEFAULT_HOURS_THRESHOLD and the
invalid input) instead of proceeding with NaN or negative values.
- Around line 126-145: The PR author's own activity is currently being added to
allReviewers from both reviews.data and reviewComments.data; adjust the loops
that add review submitters (reviews.data.forEach) and review-comment authors
(reviewComments.data.forEach) to skip entries where review.user.login ===
pr.user.login (same check as used for allIssueComments.data). In practice,
update the conditional inside the reviews.data.forEach and
reviewComments.data.forEach blocks to also require comment.user.login !==
pr.user.login (or review.user.login !== pr.user.login) before calling
allReviewers.add so the PR author cannot suppress reminders by reviewing or
commenting on their own PR.
- Around line 76-118: The current calls to github.rest.issues.listComments,
github.rest.pulls.listReviews, and github.rest.pulls.listReviewComments use
per_page:100 and access .data, which misses pages; replace each with
github.paginate(...) for the corresponding REST method (e.g.,
github.paginate(github.rest.issues.listComments, {...}),
github.paginate(github.rest.pulls.listReviews, {...}),
github.paginate(github.rest.pulls.listReviewComments, {...})), remove the
`.data` accesses (so issueComments, reviews, reviewComments become plain
arrays), and update usages like issueComments.data.some(...) ->
issueComments.some(...), reviews.data.length -> reviews.length, and
reviewComments.data -> reviewComments so logic that checks notificationMarker,
reviewer counts, and comments works across all pages.

---

Duplicate comments:
In @.github/workflows/pr-review-reminder.yml:
- Around line 151-152: When removing exempt reviewers, also exclude generic
automation accounts instead of only using the hard-coded exemptBots list: when
you build or prune allReviewers (the block that currently calls
exemptBots.forEach(bot => allReviewers.delete(bot))), iterate the reviewer
identities and delete any whose login indicates a bot (e.g., user.type === 'Bot'
or login.endsWith('[bot]')) in addition to deleting entries in
exemptBots/EXEMPT_BOTS; this ensures both explicit exemptions and any new GitHub
App/bot accounts are filtered out.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5946ba2f-9c48-4e41-96be-a097f04d53b8

📥 Commits

Reviewing files that changed from the base of the PR and between bbaff7d and 503d00d.

📒 Files selected for processing (2)
  • .github/PR_REVIEW_REMINDER_SETUP.md
  • .github/workflows/pr-review-reminder.yml

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 8, 2026
@github-actions github-actions bot dismissed their stale review March 8, 2026 14:09

All review conversations have been resolved.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 8, 2026
Copy link

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

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

Copy link

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

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 8, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR has 4 unresolved review conversations. Please resolve them before this PR can be merged.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

👀 Peer Review Required

Hi @Flashl3opard! This pull request does not yet have a peer review.

Before this PR can be merged, please request a review from one of your peers:

  • Go to the PR page and click "Reviewers" on the right sidebar.
  • Select a team member or contributor to review your changes.
  • Once they approve, this reminder will be automatically removed.

Thank you for contributing! 🎉

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 8, 2026
@github-actions github-actions bot dismissed their stale review March 8, 2026 17:57

All review conversations have been resolved.

Copy link
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: 3

🤖 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/PR_REVIEW_REMINDER_SETUP.md:
- Around line 11-14: Update the incorrect fragment identifiers in the
quick-links: change the "How It Works" link target from
WORKFLOWS.md#how-it-works-2 to WORKFLOWS.md#how-it-works-1 and change the
"Configuration" link target from WORKFLOWS.md#configuration-1 to
WORKFLOWS.md#configuration in the .github/PR_REVIEW_REMINDER_SETUP.md file so
the "How It Works" and "Configuration" anchors match the headings in
WORKFLOWS.md.

In @.github/workflows/pr-review-reminder.yml:
- Around line 160-163: The catch blocks that currently log errors and return
false (the reviewer-lookup catch and the notification-send catch) are turning
transient GitHub API failures into a silent “all clear”; update these blocks to
propagate failures instead of swallowing them: replace the return false behavior
with pushing a failure record into a shared failures array (include PR number,
action, and error) or rethrow the error so the main loop can detect it, and
update the final summary logic to include the failures array alongside successes
so API errors are reported separately; make this change for the reviewer lookup
catch and the notification-send catch (the two catch blocks that log the error
and return/continue).
- Around line 64-67: Update the marker-checking logic so the workflow only
treats a comment containing notificationMarker as authoritative if the comment
author is a trusted actor (e.g., "github-actions[bot]"); add an allowlist
(TRUSTED_ACTORS env or hardcoded set) and change the checks that currently just
inspect comment.body (the branches around the notificationMarker handling and
the allReviewers exclusion) to also verify comment.author.login is in the
trusted set before skipping/removing reviewers—use the existing
notificationMarker and exemptBots variables and apply this check at both places
that filter comments (the marker-detection branch and the allReviewers filter).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 84b46964-604f-4528-a87d-282fbbd617c4

📥 Commits

Reviewing files that changed from the base of the PR and between 503d00d and 65db551.

📒 Files selected for processing (3)
  • .github/PR_REVIEW_REMINDER_SETUP.md
  • .github/WORKFLOWS.md
  • .github/workflows/pr-review-reminder.yml

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 8, 2026
Copy link
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.

♻️ Duplicate comments (1)
.github/workflows/pr-review-reminder.yml (1)

219-222: ⚠️ Potential issue | 🟠 Major

Error in notifyMaintainers is logged but not propagated.

When createComment fails at line 191, the catch block at lines 219-221 logs the error but does not throw, so the main loop treats notification failures as success. This is inconsistent with shouldNotifyPR which now throws on error. If posting the comment fails, the PR should be tracked as failed.

🔧 Proposed fix
               } catch (error) {
                 console.error(`Error notifying maintainers for PR #${pr.number}:`, error);
+                throw error;
               }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-review-reminder.yml around lines 219 - 222, The catch
in notifyMaintainers currently only logs the error (from createComment) and
swallows it; change notifyMaintainers to rethrow the error after logging (or
throw a new Error with context) so callers can detect failure—aligning behavior
with shouldNotifyPR which throws on error; update the catch in notifyMaintainers
(the block catching errors around createComment) to rethrow the caught error (or
throw a wrapped error that includes the PR number and original error) so the
main loop will treat the notification as failed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/pr-review-reminder.yml:
- Around line 219-222: The catch in notifyMaintainers currently only logs the
error (from createComment) and swallows it; change notifyMaintainers to rethrow
the error after logging (or throw a new Error with context) so callers can
detect failure—aligning behavior with shouldNotifyPR which throws on error;
update the catch in notifyMaintainers (the block catching errors around
createComment) to rethrow the caught error (or throw a wrapped error that
includes the PR number and original error) so the main loop will treat the
notification as failed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0f21b30b-bb07-4125-bc17-e3b4f389b9f7

📥 Commits

Reviewing files that changed from the base of the PR and between 65db551 and 00ad51b.

📒 Files selected for processing (2)
  • .github/PR_REVIEW_REMINDER_SETUP.md
  • .github/workflows/pr-review-reminder.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 3 PR changes 3 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants