Page
Library
Module
Module type
Parameter
Class
Class type
Source
A Slackbot for GitHub monorepos. Configure how repo notifications should be routed to specified Slack channels based on file prefixes, issue/PR labels, and CI build statuses.
Install via OPAM:
opam install monorobotOr install dependencies and build locally:
opam install --deps-only .
makeRun the _build/default/src/monorobot.exe binary. The following commands are supported.
run: Launch the HTTP servercheck_gh <GH_PAYLOAD>: read a Github notification from a file and display the actions that will be taken (used for testing)check_slack <SLACK_PAYLOAD>: read a Slack notification from a file and send it to a channel (used for testing)Configure GitHub
repo scope and store it in the gh_token field of the secrets file.<server_domain>/github.gh_hook_token field of the secrets file.Configure Slack
Set up notifications with one of the following methods:
chat:write (for per-channel authorization) or chat:write.public (for authorization to all channels). Copy the generated bot token (xoxb-XXXX) to the slack_access_token field of your secrets file. This token is used by the bot to authenticate to the workspace, and remains valid until the token is revoked or the app is uninstalled. If you use the chat:write scope, add the bot to each channel you want to notify.slack_hooks field of your secrets file. If you decide to notify additional channels later, you will need to update the secrets file with the new webhooks and restart the server.You can configure Monorobot to unfurl GitHub links in Slack messages. Currently, commit, pull request, and issue links are supported.
Note: The slack_access_token must be configured in your secrets file for link unfurling. See previous section for details.
links:read and links:write permissions.<server_domain>/slack/events. Ensure the server is running before triggering the handshake.The bot expects two configuration files to be present.
curl -X POST \
http://localhost:8080/github \
-H 'Content-Type: application/json' \
-H 'User-Agent: {whatever user agent you define}' \
-H 'X-Github-Event: pull_request' \
-H 'X-Hub-Signature: {a signature value you define}' \
-H 'cache-control: no-cache' \
-d @mock_payloads/pr_notification.jsonThere are more payloads which will use a different X-Github-Event signature:
pull_request => mock_payloads/pr_notification.json
push => mock_payloads/push_notification.json
check_suite => mock_payloads/ci_notification.json