Skip to content

Instructions to deploy a fork

Prakhar Gurunani edited this page Apr 4, 2020 · 4 revisions

Hello !

You must be here because you either want to enable the service for some private repositories you maintain or to experiment with the bot by creating a fork. That's awesome !

Note : The simplest (not recommended) solution is to add the bot @Autolinks as a collaborator to the repositories you want this service to work for. But that does not guarantee the privacy of your code. The following instructions are hence written for maintaining the privacy.

Step 1 : Create a GitHub account

You need to create a GitHub account for the bot. You'll later add this bot as a collaborator to the repositories you want to enable it for. Basically, it should have the access to see and comment wherever it needs to.

Step 2 : Generate a personal access token

We need an access token of the bot to use its permissions from the command line. While logged in as the bot, go to its Settings. In the bottom left, you may see Personal access tokens menu. Click on the Generate new token. Select whatever scopes you want but we need user, repo and gist scopes for the bot to work. Once generated, keep this token safe for about a minute. We will need it while deploying the app to Heroku.

Step 3 : Deploy !

Please click on Watch button to get notifications about new releases.

Here's my favorite button of the moment

Deploy to Heroku

Pick an app name. How about Autolinks-{yourusername} ?

There are some environment variables that you need to add over there. Use the GitHub token we generated in the GITHUB_TOKEN field. Now create a secret and set it to GITHUB_PAYLOAD_SECRET.

Step 4 : Configure webhooks

Congratulations on deploying your new app ! The url of the app is https://{yourappname}.herokuapp.com and it's ready to receive some requests now. Now, whenever a new issue is created or updated, our app can be notified by using webhooks. Let's configure them.

  • Go to the settings of the repository you want the service for.
  • Go to Webhooks. Add a new webhook.
  • In the Payload URL, enter the url where we will receive the JSON data from GitHub i.e. https://{yourappname}.herokuapp.com/github/callback
  • Set Content type to application/json
  • In the events, Let me select individual events.
  • Select Issues, Issue Comment.
  • Click Add webhook.
  • You're good to go !

Now it is important to note that your Autolinks bot must have permissions to all the repos you want the service for. In case the issue is created from a secret fork of the secret repository, the bot needs to be added to the fork too. The process might be a little cumbersome, but hey we don't need a server maintaining any OAuth application. Plus it's free and secure all the way.

Kudos and thanks for using Autolinks!

~ @prakhargurunani

Heroku-Logo

Clone this wiki locally