Giter Club home page Giter Club logo

review-bot's Introduction

Review-Bot

A Slack Integration to speed up Pull Requests Reviews for Organizations using Slack and Github ๐Ÿจ

Features: (as of Version 1.0)

  • Supports Slack Notifications (messages) for the following events:
    • Requesting a Reviewer for a Pull Request.
    • Approving a Pull Request.
    • Submitting a review with general comments.
    • Submitting a review requesting changes.
  • Direct link to pull request in the Slack message.

Setup - TL;DR version

  • Clone the repository git clone [email protected]:abinavseelan/review-bot.git
  • Create a config.js file in the root of your project. Set the slack_webhook variable and export it.
  module.exports = {
    slack_webhook: "<your slack integration\'s webhook>"
  };
  • Deploy ๐Ÿš€!
  • On your github repository's settings, add a new webhook and set the payload url to your server's /github endpoint. (eg. <domain/ip of server>/github)
  • Add the integration to your slack channel!

Setup - Full Guide:

The full guide will help you setup the bot to work with your Slack Channel and your Github Repository. The bot will be deployed to Heroku, a free and rather awesome Cloud hosting provider for NodeJS applications.

The only assumptions we will be making are that you know how to use the terminal and have some basic knowledge of Git and pushing to remote repositories. (If you've already used Github, then you know what a remote repository is! ๐Ÿ˜„)

Step 1: Clone the repository

clonefromgithub

Copy the link from the Clone Tab and in your terminal, clone the repository using the $ git clone command

$ git clone https://github.com/abinavseelan/review-bot.git

Step 2: Create a Heroku Application

Prerequisite: The Heroku CLI is required to connect to Heroku via the Command Line. Visit this setup guide to download the required dependencies.

Once you're all set with :point-up:, make sure you're inside the repository folder and run heroku create. This will create a Heroku application (technically a repository on Heroku) and the repository will be added as a remote repository to your local repository called heroku

heroku remote

Step 3: Create a Slack Incoming Integration

To create Slack Integration for your Slack Organization, head over to https://<your_organization_name>.slack.com/apps/build/custom-integration and click on Incoming WebHooks

incomingwebhooklanding

This will take you to the Customization Page. There are a few things you can do here. You can set which channel you want the integration to be a part of, you can set the icon for the integration. The most important entity however is the Slack Webhook Url. Copy this URL!

incomingwebhookcustomization

Step 4: Create a Configuration File

In the root of the project, create a config.js file. In that file, add the following code.

module.exports = {
  slack_webhook: "<paste_the_copied_slack_webhook_url_here>"
};

This tells our bot which URL to hit when information from pull requests comes to it.

Step 5: Deploy to Heroku ๐Ÿš€

You're all set! Now we just need to do one more thing to make this (or rather your) application live.

Inside the repository folder, commit the new config.js file using the git commit command. Once you've commited the file, you can push all the code to Heroku using git push heroku master. This will push all your local files to Heroku's remote repository. Heroku will now take those files and start the Bot for us.

When you run the git push heroku master command, you'll see the build logs from Heroku. Once it's done, it will display the public url that your application/bot is running on.

To test if your application is running or not, just visit <heroku_public_url_for_your_app>/ping on your browser and you should see the following output

botpong

Step 6: Configuring Github

Now that we have the Bot up and running, we need to configure the github repositories for which we want the Bot to monitor Pull request activity.

Got to the repository you want to monitor and click on the Settings icon.

settings

Click on the Webhooks option on the side menu

webhooklandin

Click on Add Webhook on the right side corner. You might be prompted for your Github Password. Once that's done, you should be taken to a screen that looks like this.

webhook1

There, in the payload url section, add <heroku_public_url_for_your_app>/github.

Scroll down a little and you will see that you can choose what events you want Github to notify the Bot on. Choose the following options, just to reduce the load on the Bot.

webhook2

And that's that! Click Save and you have a working Slack integration/bot that will monitor the configured repository for Pull Request Activity.

review-bot's People

Contributors

abinavseelan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kr-bots namng5555

review-bot's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.