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
- 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
Contributions to this repo are welcome!
To work on the code in this repo, you'll need a few things:
- A Slack account and bot token - see Creating the Slack Bot
- A GitHub account and access token - see Configuring the GitHub Token
- A config file - see Creating the Config File
- A configured environment - see Configuring the Environment
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
Once you have a Slack account, you can create a Slack bot using the following steps.
- Go to the Slack apps management page: https://api.slack.com/apps/
- Click the “Create New App” button.
- If this is your first time visiting this page, it should be very prominent.
- Fill out the basic info for your “App” - this will include the name of your app (and bot user) in Slack.
- Click on “OAuth & Permissions” in the left sidebar.
- Scroll down to “Scopes.”
- Under “Bot Token Scopes,” click “Add an OAuth Scope.”
- 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
- Scroll back to the top of the page.
- Click “Install to Workspace.”
- Select your workspace.
- You should now have a “Bot User OAuth Token” that you can use in your workspace as your bot.
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 teamsread:user
user:email
The configuration file has a specific schema - see example/config.json for an example. See config.py for more information on supported configuration.
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.
There aren't any tests yet. Please add some tests if you have some time!