Skip to content

Remind teammates of Pull Requests in need of review.

License

Notifications You must be signed in to change notification settings

seeq12/pr-reminders

Repository files navigation

Introduction

The tool will

  • notify the reviewers of PRs needing review on a Slack channel (PRs with 0 reviews and number of review requests > 0 having at least one reviewer from the Team)
  • notify the reviewers of sleeping PRs on a Slack channel (PRs with no activity in tha last 3 days)
  • notify the reviewers of PRs with no primary reviewer on a Slack channel

Configuration of the tool

Environment variables

  • GITHUB_ACCESS_TOKEN - Github access token to be used to call the Github API to find open PRs
  • SLACK_BOT_ACCESS_TOKEN - Slack access token to be used to send the reminders
  • PR_REMINDERS_CONFIG_PATH - The json file specific to your team. Example: example/config.json

Contributing

Contributions to this repo are welcome!

To work on the code in this repo, you'll need a few things:

Then, it's recommended to create a virtual environment using Python 3.11 (see the venv documentation):

python3 -m venv .venv
source .venv/bin/activate

Then, you're ready to install dependencies:

pip install -r requirements.txt

And finally, run the bot:

python main_reminders.py

Creating the Slack Bot

Once you have a Slack account, you can create a Slack bot using the following steps.

  1. Go to the Slack apps management page: https://api.slack.com/apps/
  2. Click the “Create New App” button.
  3. If this is your first time visiting this page, it should be very prominent.
  4. Fill out the basic info for your “App” - this will include the name of your app (and bot user) in Slack.
  5. Click on “OAuth & Permissions” in the left sidebar.
  6. Scroll down to “Scopes.”
  7. Under “Bot Token Scopes,” click “Add an OAuth Scope.”
  8. Add the scopes you need for your bot. For this app, you'll need to read some basic user data (ID and email), join a channel, and send messages, so add:
    • channels:join
    • chat:write
    • users:read
    • users:read.email
  9. Scroll back to the top of the page.
  10. Click “Install to Workspace.”
  11. Select your workspace.
  12. You should now have a “Bot User OAuth Token” that you can use in your workspace as your bot.

Configuring the GitHub Token

First, see Managing your personal access tokens for how to set up a personal access token.

The token will need the following permissions:

  • repo (all permissions)
  • read:org - to properly expand teams
  • read:user
  • user:email

Creating the Config File

The configuration file has a specific schema - see example/config.json for an example. See config.py for more information on supported configuration.

Configuring the Environment

You can configure your environment in the usual way (.zshrc etc.), or you can use the built-in dotenv support.

The environment variables you'll need to set are described in Environment variables.

Test

There aren't any tests yet. Please add some tests if you have some time!

About

Remind teammates of Pull Requests in need of review.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published