A slackbot that reminds reviewers to review their pull requests on AWS.
Related project: kentaro-m/pr-notify-bot: A slackbot that reminds reviewers to review their pull requests.
- Automatic addition of reviewers to pull requests
- Send notifications to Slack
- Pull request can be merged
- Pull request review request is created
- Mention comment is created on a pull request
- Go to your project settings > Webhooks > Add webhook
- Payload URL
https://<API ID>.execute-api.<AWS Region>.amazonaws.com/<Stage Nåame>/webhook
- Content type
application/json
- Secret any value
- Events Pull request, Pull request review, Pull request review comment
$ git clone https://github.com/kentaro-m/lambda-pr-notify-bot.git
$ cd lambda-pr-notify-bot
$ npm install
$ npm run package
Installing packages and building code.
{
"host": "", // Required if using GitHub Enterprise
"pathPrefix": "", // Required if using GitHub Enterprise
"organization": "",
"repositories": [ // Repositories that allows bot actions
"unleash-sample"
],
"reviewers": [ // Pull request reviewers (GitHub username)
"matsushita-kentaro"
],
"approveComments": [ // Comment on approving pull request
"+1",
"LGTM"
],
"numApprovers": 1, // Number of people required for pull request approval
"slackUsers": { // Association between Slack user name and Github user name
"matsushita-kentaro": "kentaro",
"kentaro-m": "kentaro"
},
"message": { // Message to notify to Slack
"requestReview": "Please review this pull request.",
"ableToMerge": "Able to merge this pull request.",
"mentionComment": "Please check this review comment."
},
"assignReviewers": true, // Bot adds a assignees to the pull request
"requestReview": true, // Bot adds a reviewers to the pull request
"ableToMerge": true, // Notify Slack that pull requests can be merged
"mentionComment": true // Notify mention comment to Slack
}
Add reviewers (GitHub username), repositories and Slack username to config/default.json
. Also, if necessary change other setting items.
- GITHUB_API_TOKEN A token for obtaining information on pull requests (scope: repo)
- SLACK_API_TOKEN A token for sending messages to Slack (scope: chat:write:bot)
- SECRET_TOKEN A token for securing webhook
Add environment variables to template.yml. (or Add environment variables on the Lambda management console.)
$ aws cloudformation package --template-file template.yml --s3-bucket <Your bucket name> --output-template .sam/packaged.yml
$ aws cloudformation deploy --template-file ./.sam/packaged.yml --stack-name <Your stack name> --capabilities CAPABILITY_IAM
Upload the SAM template to S3 and deploy it.
MIT