Probot build github apps to automate
and improve your workflow ! 😍

Usama Liaquat
3 min readJan 18, 2019

--

Probot is actually an opensource library that allow you to create github app’s without worry about the whole configuration. Actually it’s a framework for building GitHub Apps in Node.js. It aims to eliminate all the drudgery–like receiving and validating webhooks, and doing authentication handstands–so you can focus on the features you want to build.

Probot apps are easy to write, deploy, and share. Many of the most popular Probot apps are hosted, so there’s nothing for you to deploy and manage. Here are just a few examples

Don’t know what to build? Browse the list of ideas from the community for inspiration.
Wanna to build from scratch! excited
Let’s get started.

Step : 01

Choose your any idea in list of ideas .
To develop a Probot app, you will first need a recent version of Node.js installed. Open a terminal and run node -v to verify that it is installed and is at least 8.3.0 or later. Otherwise, install the latest version.

Step : 02

To get started, run one of these commands to create probot app:

  • If you’re using npm: $ npx create-probot-app my-first-app
  • or, if you’re using Yarn: $ yarn create probot-app my-first-app

This will ask you a series of questions about your app, which should look something like this:

Let's create a Probot app!
? App name: my-first-app
? Description of app: A "Hello World" GitHub App built with Probot
? Author's full name: Usama liaquat
? Author's email address: inconnent12345@outlook.com
? Homepage:
? GitHub user or org name: Usamaliaquat123
? Repository name: my-first-app
? Which template would you like to use? (Use arrow keys)
❯ basic-js
checks-js
git-data-js
deploy-js
basic-ts
created files...
Finished scaffolding files!
Installing Node dependencies!Done! Enjoy building your Probot app!

Step: 03

Go to the directory and type

  • If you’re using npm: $ npm install
  • or, if you’re using Yarn: $ yarn add .

That’s it. Now you’re ready to run the app on your local machine. Run npm run dev to start the server:

To automatically configure your GitHub App, follow these steps:

  1. Run the app locally by running npm run dev.
  2. Next follow instructions to visit localhost:3000 (or your custom Glitch URL).
  3. You should see something like this:

Run the app locally by running npm run dev

Go ahead and click the Register a GitHub App button.

Next you’ll get to decide on an app name that isn’t already taken.

After registering your GitHub App, you’ll be redirected to install the app on any repos. At the same time, you can check your local .env and notice it will be populated with values GitHub sends us in the course of that redirect.

Install the app on a test repo and try triggering a webhook to activate the bot!

You’re all set! Head down to Debugging to learn more about developing your Probot App.

GitHub App Manifests — otherwise known as easy app creation — make it simple to generate all the settings necessary for a GitHub App. This process abstracts the Configuring a GitHub App section. You can learn more about how GitHub App Manifests work and how to change your settings for one via the GitHub Developer Docs.

Closer look of index.js

Actually a probot app is just a Node.js module that exports a function: like this

module.exports = app => {
// To get started, run one of these commands:
If you're using npm: $ npx create-probot-app my-first-app
or, if you're using Yarn: $ yarn create probot-app my-first-appyour code here
}

The app parameter is an instance of Application and gives you access to all of the GitHub goodness.

app.on will listen for any webhook events triggered by GitHub, which will notify you when anything interesting happens on GitHub that your app wants to know about.

So that’s it. Thanks ❤️

--

--