status-im / status-github-bot

A bot for github
https://status-github-bot.herokuapp.com/
ISC License
11 stars 12 forks source link

statusbot

statusbot is a chat bot built on the Probot framework. A wiki is available here.

This README will help you get started. It will be updated and improved to discuss user-specific instances, usage and deployment, the functionality available, and more!

What does the bot do?

The project board's 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).

Development

To get your environment set up, go through the following steps:

  1. Run yarn install.
  2. Populate .env.

    cp .env.example .env213804
    
    # edit .env file to contain proper config

After this, you can start the bot by running the following:

yarn start

Creating the Slack Bot Integration

  1. Go to https://my.slack.com/services/new/bot.
  2. Add a bot integration.
  3. Note the bot token starting with xoxb-, and put it into .env.

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. The app needs to be created only once and can be made public and reused for any number of repositories and organizations.

See the official docs for deployment.

  1. Create the GitHub App:
    1. In GitHub, go to Settings/Developer settings/GitHub Apps and click on New GitHub App
    2. Enter the bot name in GitHub App name, e.g. Status GitHub Bot
    3. In Homepage URL, enter the /ping endpoint of the service, e.g. https://5e63b0ab.ngrok.io/ping
    4. In Webhook URL, enter the root endpoint of the service, e.g. https://5e63b0ab.ngrok.io/
    5. In Webhook secret (optional), enter a string of characters that matches the value passed in the in the WEBHOOK_SECRET environment variable.
    6. This app requires these Permissions & events for the GitHub App:
      • Commit statuses - Read & write
      • Issues - Read & Write
        • [x] Check the box for Issue comment events
        • [x] Check the box for Issues events
      • Pull requests - Read & Write
        • [x] Check the box for Pull request events
        • [x] Check the box for Pull request review events
        • [x] Check the box for Pull request review comment events
      • Repository contents - Read-only
        • [x] Check the box for Push events
      • Repository projects - Read & Write
        • [x] Check the box for Project for repository projects events
        • [x] Check the box for Project card for repository projects events
      • Organization projects - Read-only
        • [x] Check the box for Project for organization projects events
      • Single File - Read-only
        • Path: .github/github-bot.yml
    7. 🔍 Verify that you have ticked 9 boxes.
    8. Generate a private key pass and save it.
  2. Installing the bot service:
    1. Deploy the bot to the cloud.
    2. Set the APP_ID environment variable to value reported when the GitHub App was created.
    3. Set the WEBHOOK_SECRET environment variable to the value configured in the GitHub App.
    4. Set the PRIVATE_KEY environment variable to the contents of the .pem file.
    5. Set the SLACK_BOT_TOKEN environment variable to the value reported for the bot in Slack.
  3. Install the GitHub App in an account:
    1. Select the repositories where the bot should work (e.g. status-react).

Customizing the bot

The bot gets its settings from a per-repo file located at .github/github-bot.yml. That file extends the base file at the status-im/probot-settings repo.

Examples of settings that can be configured:

Restart the bot

You may want to get comfortable with heroku logs and heroku restart if you're having issues.