4.2 KiB
statusbot
statusbot is a chat bot built on the Probot framework. There's a wiki available here.
This README is intended to help get you started. Definitely update and improve to talk about your own instance, how to use and deploy, what functionality is available, etc!
What does the bot do?
Right now the bot has two sets of capabilities:
- Doing background management in GitHub:
- Assign new PRs to the
Pipeline for QA
project board (REVIEW
column). - Move existing PRs to the correct
Pipeline for QA
project board column (REVIEW
/IN TEST
) depending on whether or not the required conditions are met (is mergeable, at least two reviewers have approved and there is no request for changes). - Assign issues that are labeled
bounty-awaiting-approval
to theStatus SOB Swarm
project board (bounty-awaiting-approval
column). - Welcome users who post their first PR in a project.
- Checks if all commits are GPG-signed and sets the PR status accordingly.
- Unfurls links on Issues and Pull Request discussions.
- Disallows merging of PRs containing WIP in the title.
- New functionality will be added in the future (wishlist is being tracked here)
- Assign new PRs to the
The project board names, column names, welcome message and other values are stored in the .github/github-bot.yml
file. It can be overriden for each specific repository by adding a file in the same path on the respective repository (see probot-config).
Creating the bot GitHub App
This bot is meant to be packaged as a GitHub App. There are two steps to it: creating the app, and installing the app. Creating a GitHub App only needs to be done once and the app can be made public to be reused for any number of repositories and organizations.
See the official docs for deployment.
- Create the GitHub App:
- In GitHub, go to
Settings/Developer settings/GitHub Apps
and click onNew GitHub App
- Enter the bot name in
GitHub App name
, e.g.Status GitHub Bot
- In
Homepage URL
, enter the/ping
endpoint of the service, e.g. https://5e63b0ab.ngrok.io/ping - In
Webhook URL
, enter the root endpoint of the service, e.g. https://5e63b0ab.ngrok.io/ - In
Webhook secret (optional)
, enter a string of characters that matches the value passed in the in theWEBHOOK_SECRET
environment variable. - This app requires these Permissions & events for the GitHub App:
- Commit statuses - Read & write
- Issues - Read & Write
- Check the box for Issue comment events
- Check the box for Issues events
- Pull requests - Read & Write
- Check the box for Pull request events
- Check the box for Pull request review events
- Check the box for Pull request review comment events
- Repository contents - Read-only
- Check the box for Push events
- Repository projects - Read & Write
- Check the box for Project for repository projects events
- Organization projects - Read-only
- Check the box for Project for organization projects events
- Single File - Read-only
- Path:
.github/github-bot.yml
- Path:
- Generate a private key pass and save it.
- In GitHub, go to
- Installing the bot service:
- Deploy the bot to the cloud.
- Set the
APP_ID
environment variable to value reported when the GitHub App was created. - Set the
WEBHOOK_SECRET
environment variable to the value configured in the GitHub App. - Set the
PRIVATE_KEY
environment variable to the contents of the.pem
file. - Set the
SLACK_BOT_TOKEN
environment variable to the value reported for the bot in Slack.
- Install the GitHub App in an account:
- Select the repositories where the bot should work (e.g.
status-react
).
- Select the repositories where the bot should work (e.g.
Restart the bot
You may want to get comfortable with heroku logs
and heroku restart
if
you're having issues.