Categorygithub.com/geckoboard/cake-bot
modulepackage
0.0.0-20241010100250-c11a7c66d8ff
Repository: https://github.com/geckoboard/cake-bot.git
Documentation: pkg.go.dev

# README

cake-bot Deploy

Cake bot is your friendly neighbourhood code review assistant!

At Geckoboard we do code review on just about every change that's deployed. This process isn't meant for making it easier to micro-manage other people's work. Instead it's meant to help ensure that at least several members of the team know how the platform is changing, and provides an opportunity for us to help each other see problems from a different perspective.

This article goes into a lot of detail about a style of code review that's very close to what we use at Geckoboard.

Cake Bot listens for GitHub events and notifies your team on Slack. The following notifications are currently supported:

  • When a review is requested, Cake Bot will notify the person that has been chosen for the review;
  • When someone reviews a pull request, Cake Bot will notify the pull request author about any new comments;
  • When a pull request is accepted by the reviewer, the PR author will be notified that they have cake! (Figuratively)

Cake bot can use information in the slack team directory to work out which slack users match up with which GitHub users. Create a profile field in your Slack team called github and ask users to enter their GitHub username in it.

Configuration

At a minimum you will need to specify these environment variables:

  • PORT The HTTP port on which to listen for webhooks.
  • SLACK_TOKEN An API key that can scan your slack's team directory.
  • GITHUB_SECRET A secret key for validating GitHub webhooks. You can create this using uuidgen and configure it in Github's webhook settings.

The SLACK_TOKEN must have the following scopes:

  • users:read, users:read.email, users.profile:read
  • chat:write

During development you can set these variables in a .env file in the current working directory. Cake bot will set these as environment variables.

Testing

make test

You can also send some example webhooks to the server during development:

$ cat example-webhooks/pull_request_review_approved.json | curl http://localhost:8090/github \
  -X POST \
  -H "X-GitHub-Event: pull_request_review" \
  -d @-

Running

make run

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

NewGitHubWebhookValidator instantiates a new GitHubWebhookValidator given the secret key.
No description provided by the author
No description provided by the author

# Structs

GitHubWebhookValidator implements the validation of GitHub webhook requests using a secret key.
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
WebhookValidator interface validates the incoming webhook request.