Skip to content

Snitch is a Slack bot that fetches pending review PRs built in Go

License

Notifications You must be signed in to change notification settings

ezeoleaf/snitch

Repository files navigation

Snitch

Go

Snitch is a Slack bot that fetches and publish PRs with pendings reviews in channels or via DM

Disclaimer

I hold no liability for what you do with this bot or what happens to you by using this bot.

Usage

Configuring the bot

Before running the bot, you must first set it up so it can connect to Github and Slack API.

To do this, you will need to setup the following environment variables:

- ENTERPRISE_GITHUB (Only to true if you are using an enterprise version of Github)
- GITHUB_ADDRES (Only if you are using an enterprise version of github. The URL should be like https://github.{company}.io/)
- GITHUB_TOKEN (Your generated token with **repo** and **user** permissions granted)
- HTTP_ADDRESS (The address of the server where your bot is running)
- SLACK_API_TOKEN (A bot token generated for an Slack application)

For generating Github access token you can follow this guide

For creating a Slack application you can follow this guide

After creating the Slack application, you need to create two slash commands:

  • repo-prs: (This will receive a Github repository and returns all the PRs and Issues in it)
  • user-prs: (This will receive a Github username and returns all the PRs and Issues that the user has pending of review)

image

Running locally

For running the bot locally I recommend using ngrok to redirect the HTTP calls from Slack to your local environment.

Note: This is only recommended for testing purposes

How does it look like?

When using:

  • /repo-prs ezeoleaf/snitch image

  • /user-prs ezeoleaf image

Have questions? Need help with the bot?

If you're having issues with or have questions about the bot, file an issue in this repository so anyone can get back to you.

Or feel free to contact me [email protected] :)