Probot build github apps to automate
and improve your workflow ! đ
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:
- Run the app locally by running
npm run dev
. - Next follow instructions to visit localhost:3000 (or your custom Glitch URL).
- 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 â¤ď¸