Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: create pr reminder action #993

Merged
merged 2 commits into from
Sep 26, 2024
Merged

chore: create pr reminder action #993

merged 2 commits into from
Sep 26, 2024

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Sep 25, 2024

Summary by CodeRabbit

  • New Features
    • Introduced an automated reminder system for open pull requests, notifying team members via Slack every weekday at 9:00 AM UTC.
    • The reminders include a summary of open pull requests, enhancing visibility and encouraging timely reviews.

@tac0turtle tac0turtle requested a review from a team as a code owner September 25, 2024 12:55
Copy link

coderabbitai bot commented Sep 25, 2024

Warning

Rate limit exceeded

@tac0turtle has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 1 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Files that changed from the base of the PR and between b07b29f and 101a173.

Walkthrough

A new GitHub Actions workflow named pr-reminder.yml has been added to automate reminders for open pull requests. This workflow is scheduled to run every weekday at 9:00 AM UTC and also triggers on pull request events. It retrieves a list of open pull requests, excluding drafts, and sends a formatted notification to a specified Slack channel if any are found.

Changes

File Change Summary
.github/workflows/pr-reminder.yml Added new workflow for PR reminders, including scheduling, PR retrieval, and Slack notification.

Poem

In the meadow where bunnies play,
A reminder hops in every day.
Open PRs, we won't forget,
With a Slack nudge, no need to fret!
So let’s review, don’t delay,
Together we’ll code, hip-hip-hooray! 🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 34895bf and b07b29f.

📒 Files selected for processing (1)
  • .github/workflows/pr-reminder.yml (1 hunks)
🔇 Additional comments not posted (3)
.github/workflows/pr-reminder.yml (3)

8-9: LGTM: Appropriate permissions set.

The workflow correctly sets only the necessary read permissions for pull requests, adhering to the principle of least privilege.


11-16: LGTM: Job setup and checkout step are well-configured.

The job configuration uses the latest Ubuntu runner and the current version of the checkout action, which is appropriate for this workflow.


1-51: Overall, the PR reminder workflow is well-implemented.

The workflow effectively creates a daily reminder for open pull requests, excluding drafts, and sends a well-formatted message to Slack. The suggestions provided aim to improve flexibility and conciseness:

  1. Remove the pull request trigger to avoid unnecessary runs.
  2. Simplify the assignee formatting for better readability.
  3. Use an environment variable for the Slack channel name for increased flexibility.

These changes will enhance the workflow's efficiency and maintainability.

Comment on lines 1 to 7
name: PR Review Reminder

on:
schedule:
- cron: '0 9 * * 1-5' # Every weekday at 9:00 AM UTC
pull_request:

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider removing the pull request trigger.

The workflow is designed as a daily reminder, but it's also triggered on pull request events. This may cause unnecessary runs of the workflow every time a PR is opened, closed, or updated.

Consider removing the pull request trigger:

 on:
   schedule:
     - cron: '0 9 * * 1-5'  # Every weekday at 9:00 AM UTC
-  pull_request:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name: PR Review Reminder
on:
schedule:
- cron: '0 9 * * 1-5' # Every weekday at 9:00 AM UTC
pull_request:
name: PR Review Reminder
on:
schedule:
- cron: '0 9 * * 1-5' # Every weekday at 9:00 AM UTC

Comment on lines +38 to +51
- name: Send Slack Reminder
if: steps.pr-list.outputs.result != ''
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: pr-github
SLACK_USERNAME: PR-Reminder
MSG_MINIMAL: true
SLACK_ICON_EMOJI: ":think:"
SLACK_COLOR: good
SLACKIFY_MARKDOWN: true
SLACK_TITLE: Daily Pull Request Review Reminder
SLACK_MESSAGE: |
${{ steps.pr-list.outputs.result }}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using an environment variable for the Slack channel name.

While the Slack notification setup is generally good, the channel name is hardcoded. This might limit flexibility if you need to change the channel in different environments or contexts.

Consider using an environment variable for the Slack channel name:

 env:
   SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
-  SLACK_CHANNEL: pr-github
+  SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
   SLACK_USERNAME: PR-Reminder

Then, set the SLACK_CHANNEL secret in your repository settings. This change will make it easier to modify the target channel without changing the workflow file.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Send Slack Reminder
if: steps.pr-list.outputs.result != ''
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: pr-github
SLACK_USERNAME: PR-Reminder
MSG_MINIMAL: true
SLACK_ICON_EMOJI: ":think:"
SLACK_COLOR: good
SLACKIFY_MARKDOWN: true
SLACK_TITLE: Daily Pull Request Review Reminder
SLACK_MESSAGE: |
${{ steps.pr-list.outputs.result }}
- name: Send Slack Reminder
if: steps.pr-list.outputs.result != ''
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_USERNAME: PR-Reminder
MSG_MINIMAL: true
SLACK_ICON_EMOJI: ":think:"
SLACK_COLOR: good
SLACKIFY_MARKDOWN: true
SLACK_TITLE: Daily Pull Request Review Reminder
SLACK_MESSAGE: |
${{ steps.pr-list.outputs.result }}

Comment on lines +18 to +37
- name: List open pull requests using GitHub Script
uses: actions/github-script@v7
id: pr-list
with:
script: |
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
let table = '';
pullRequests.forEach(pr => {
const assignees = pr.assignees.length > 0 ? `Assignees: ${pr.assignees.map(assignee => assignee.login).join(', ')}` : 'No assignees';
table += pr.draft ? '' : `
Title: ${pr.title}
Link: <${pr.html_url}>
Assigness: ${assignees}
`;
});
return table;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve assignee formatting for conciseness.

The current implementation for displaying assignees is verbose and may not scale well for PRs with many assignees.

Consider simplifying the assignee display:

-              const assignees = pr.assignees.length > 0 ? `Assignees: ${pr.assignees.map(assignee => assignee.login).join(', ')}` : 'No assignees';
+              const assignees = pr.assignees.length > 0 ? pr.assignees.map(assignee => `@${assignee.login}`).join(', ') : 'Unassigned';
               table += pr.draft ? '' : `
                       Title: ${pr.title}
                       Link: <${pr.html_url}>
-                      Assigness: ${assignees}
+                      Assignees: ${assignees}
                       `;

This change will make the output more concise and easier to read, especially for PRs with multiple assignees.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: List open pull requests using GitHub Script
uses: actions/github-script@v7
id: pr-list
with:
script: |
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
let table = '';
pullRequests.forEach(pr => {
const assignees = pr.assignees.length > 0 ? `Assignees: ${pr.assignees.map(assignee => assignee.login).join(', ')}` : 'No assignees';
table += pr.draft ? '' : `
Title: ${pr.title}
Link: <${pr.html_url}>
Assigness: ${assignees}
`;
});
return table;
- name: List open pull requests using GitHub Script
uses: actions/github-script@v7
id: pr-list
with:
script: |
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
let table = '';
pullRequests.forEach(pr => {
const assignees = pr.assignees.length > 0 ? pr.assignees.map(assignee => `@${assignee.login}`).join(', ') : 'Unassigned';
table += pr.draft ? '' : `
Title: ${pr.title}
Link: <${pr.html_url}>
Assignees: ${assignees}
`;
});
return table;

@tac0turtle tac0turtle enabled auto-merge (squash) September 25, 2024 13:01
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

utACK

@tac0turtle tac0turtle merged commit d1aa970 into master Sep 26, 2024
6 of 7 checks passed
@tac0turtle tac0turtle deleted the marko/prreminder branch September 26, 2024 08:11
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.

2 participants