-
Notifications
You must be signed in to change notification settings - Fork 273
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
Conversation
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 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. WalkthroughA new GitHub Actions workflow named Changes
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
📒 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:
- Remove the pull request trigger to avoid unnecessary runs.
- Simplify the assignee formatting for better readability.
- Use an environment variable for the Slack channel name for increased flexibility.
These changes will enhance the workflow's efficiency and maintainability.
.github/workflows/pr-reminder.yml
Outdated
name: PR Review Reminder | ||
|
||
on: | ||
schedule: | ||
- cron: '0 9 * * 1-5' # Every weekday at 9:00 AM UTC | ||
pull_request: | ||
|
There was a problem hiding this comment.
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.
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 | |
- 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 }} |
There was a problem hiding this comment.
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.
- 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 }} |
- 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; |
There was a problem hiding this comment.
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.
- 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
Summary by CodeRabbit