Notify the pull request reviewer that a review request is coming, Notify the pull request author as soon as the reviewer completes the approval.
- Post a message to Slack when a particular user is added as a reviewer to a pull request
- Update messages already posted at the following events
- Yet another specific user is added as a reviewer
- Reviewer completes review
- Pull requests are merged
- The update history is threaded to the message
- Mention the Slack account of the target GitHub user
- Event > Activity Type
- pull_request
- opened
- Even if a review request is made at the same time as the PR opens, the events will occur separately.
- closed
- When a pull request merges, the
pull_request
is automaticallyclosed
. - with a conditional that checks the
merged
value of the event. alsomerged_by
.
- When a pull request merges, the
- edited
- reopened
- review_requested
- see
payload.requested_reviewer
.
- see
- review_request_removed
- see
payload.requested_reviewer
.
- see
- opened
- pull_request_review
- submitted
- when a pull request has been approved
- check the
payload.review.state
, state ==approved
then PR was approved.
- dismissed
- Change the state of the review, but not the state of the PR.
- submitted
- pull_request
- chat.postMessage
- scope
chat:write
- scope
- chat.update
- scope
chat:write
- scope
- conversations.history
- scope
channels:history
groups:history
im:history
mpim:history
- scope
- datastore
- scope
datastore:read
datastore:write
- scope
You can deploy the production version of PullRequest Handler to Slack hosting
using slack deploy
:
% slack deploy
After deploying, create new Webhook Trigger and new Link Triggers for this app. Once the Triggers are invoked, the associated Workflows should run.
To create a Link Trigger, run the following command:
# Webhook Trigger
% slack trigger create --trigger-def triggers/notifyPullRequestTrigger.ts
After selecting a Workspace, the output provided will include the Webhook Trigger Payload URL. Copy and paste this URL into a GitHub repository setting/Webhooks.
# Link Trigger
% slack trigger create --trigger-def triggers/addRepositoryMappingTrigger.ts
% slack trigger create --trigger-def triggers/addUserAccountMappingTrigger.ts
After selecting a Workspace, the output provided will include the Link Trigger Shortcut URL. Copy and paste this URL into a channel as a message, or add it as a bookmark in a channel of the Workspace you selected.
Register GitHub API Token.
% slack env add githubToken <token>
Run the addRepositoryMappingTrigger in your slack workspace. target repository's URL and target branch name, Slack channel are needed.
for example...
- repositoryURL: https://github.com/masataka/pullrequest-handler
- branch: develop
- slackChannel: #ntf-pullrequest
Run the addUserAccountMappingTrigger in your slack workspace. you can register GitHub account and Slack account pairs.
Add this app to Slack channel. setting -> integration -> app.