This guide will walk you through running a simple GitHub App that ensures every commit has the word bananas and get it running on a test repository. All of the source code you need is in this gist.
Here's what it will look like when your commits are not bananas:
…and here's what it will look like when your commits are bananas:
Ready? Let's get started!
-
Clone this gist
$ git clone https://gist.github.com/bkeepers/546efd41fa08f1af418d5c58e02ec696 bananas -
Make sure you have a recent version of Node.js installed.
$ node --version v7.8.0 -
package.jsonlists the dependencies for our app. Check it out, and then run:$ npm install -
index.jsis the meat of the app. Read through the code and see if you can make sense of what it's doing. -
Go to smee.io and click Start a new channel. Set
WEBHOOK_PROXY_URLin your.envto the URL that you are redirected to. -
Create a new GitHub App with:
- GitHub App name:
yourusername-bananas, replacingyourusernamewith your GitHub username. - Homepage URL and User authorization callback URL: It doesn't matter for this tutorial, so set to
https://github.com/yourusername, replacingyourusernamewith your GitHub username. - Webhook URL: Use your
WEBHOOK_PROXY_URLfrom the previous step. - Webhook Secret:
development - Permissions:
- Commit statuses: Read & Write
- Pull requests: Read-only
- Subscribe to events
- Pull request
- Click Create GitHub App
- GitHub App name:
-
Most importantly, your bot needs an adorable icon. Feel free to use
bananas.jpg. -
Generate a private key and move it to the project directory.

-
Edit
.envand setAPP_IDto the ID of the app you just created, andSUBDOMAINto your GitHub username.
-
Click the Install button on your app page, and install it on a repository.
-
Go back to your terminal and run
$ npm startto start the server, which will outputListening on http://localhost:3000. -
Now go to your repository and create a new file, commit it to a branch, and open a pull request.
Want to learn more:


