Become Github Pro with Probot

gaurav rawal
GDG WTM New Delhi
Published in
4 min readMar 13, 2018

While developing the project, the first thing that comes in mind is how do we manage the project? For this, the most popular and common answer comes in mind is using git and hosting it on github.

Github and git has now become a market standard that every developer uses to manage their projects. And when it comes to managing the workflow of the github, every developer finds it a tricky task. With the help of Probot you can manage the workflow very easily.

What is Probot?

Probot is a framework for building GitHub Apps in Node.js . Doing all the stuffs like receiving and validating the webhooks and doing authentication stuffs, so that you just have to focus on the development part and the features you want to build and leave the rest of the work on the app.

You can check out the awesome apps that are build using probot.

Building your first Hello-world app

Before diving deep into the coding part, these are the prerequisites that are needed to build a probot app:

Node.js- Minimum 7.6

Text Editor- Preferably VSCode

Now we are ready to rock!

The first thing you need to do is install npm package create-probot-app globally.

npm install -g create-probot-app

Now you just need to make your app with desired name, simply run this command in your desired folder

create-probot-app <app-name>

It should automatically install all the node dependencies, in my case it failed to do so. If so you could go into the app folder just created and install the dependencies using ‘npm install’.

The basic app is created, now let’s get our hands more dirty…

Inside of your app folder you could see file called .env.example, just convert it to .env. By default it looks like this.

.env.example file

You have to fill the APP_ID and WEBHOOK_PROXY_URL to configure your GitHub App in your Probot App. Let’s find out where it is…

Go to smee.io and click on Start a new channel and set WEBHOOK_PROXY_URL in .env to the URL that you are redirected to.

Now you are almost done…

Let’s create the app in github, Go to Github settings and create new app on github, or you can follow this link. There use Webhook Url same as the WEBHOOK_PROXY_URL we just created and Webhook secret as ‘development’. And make sure you give the access permissions for the events according to your need and subscribe to those events.

Access Permission
Subscribe to the events

Things to be noticed while creating the GitHub App

  • Although Homepage url is necessary to create your app, but you could give any url.
  • Webhook secret should be same in both .env file and GitHub App. Otherwise it’ll give you the following error when you run the app.
ERROR Probot: No X-Hub-Signature found on request

After creating the app you can see your App Id written there and also generate the private key. Now paste the App Id infront of APP_ID in.env file, and paste the private key in the app directory folder.

App_id and Private Key

Now, you just need to install the app into some repository.

Congrats! you just now created your first github app.

If you want to run the app you can simply write the following command in your console (If you want to log the details of the events just uncomment ‘LOG_LEVEL=trace’ in .env file).

npm start

You can come across many ideas and build come really cool stuffs to automate your workflow. If you don’t know what to build, browse the list of ideas from the community for inspiration.

You can refer to this docs. Their docs is super awesome.

If you find it useful or productive do clap to show some love 😃.

You too can share your tech blogs and get them published with GDG & Women TechMakers New Delhi to help fellow coders!

--

--