A Slack bot built using the Slack Java SDK to manage and automate PR review processes by tracking statuses, monitoring SLA times, sending reminders for overdue PRs, and notifying users when attention is needed.
- Submit PRs to manage and track them in the channel.
- Track SLA with reminders for approaching or overdue PRs.
- Update statuses with +1 or comment notification buttons.
- Notify PR authors and reviewers with status updates.
- View active PRs and their current statuses.
-
Clone the Repository:
git clone https://github.com/yujiashen/PR-Reminder-Bot-Java.git cd PR-Reminder-Bot-Java -
Set Up Environment Variables:
- Create a
.envfile in the root directory and add your Slack API credentials:SLACK_BOT_TOKEN=xoxb-your-slack-bot-token SLACK_SIGNING_SECRET=your-slack-signing-secret
- Create a
-
Build the Project:
- Make sure you have Maven installed.
- Navigate to the project directory and build the project:
mvn clean install
-
Run the Bot: After building, you can run the bot using:
java -jar target/pr-reminder-bot.jar
-
Start the Cron Job: The bot uses a cron job to check SLA times and notify channels periodically. To start the cron job:
- Open the terminal and run:
crontab -e
- Add the following line to schedule the job (modify the path as necessary):
This cron job will run every hour from 9 AM to 4 PM PST, Monday through Friday.
0 9-16 * * 1-5 /usr/bin/java -jar /path/to/PR-Reminder-Bot-Java/target/pr-reminder-bot.jar - Save and close the cron file.
- Open the terminal and run:
- PR Submission: To submit a PR for review, use the
/pr-submitcommand and enter the details. - Active PRs: Use
/pr-activeto see the current status of all active PRs in the channel. - Settings: Use
/pr-settingsto adjust SLA time and notification frequency by channel (default is 8 hours and every hour from 9 to 4 PST).
| Command | Description |
|---|---|
/pr-submit |
Submit a PR for review |
/pr-active |
View all active PRs in the current channel |
/pr-settings |
Configure SLA settings |
This bot currently uses Moto to mock AWS DynamoDB for testing purposes.
To run tests:
mvn test- **Java**: Ensure that you have Java 11+ installed.
- **Maven**: Maven is used for managing dependencies and building the project.