Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
Piyush Raj edited this page Dec 29, 2017 · 3 revisions

Running on Heroku

Prerequisites

You need:

  • A Heroku account
  • Installed copy of the Heroku Toolbelt
  • A GitHub user for the bot to operate as. The user needs Collaborator permissions on the GitHub repo(s) it will be used on
  • Create a GitHub Issues label in the repo(s). This label will indicate that the issue is blocked waiting for a reply from a user. In this example, the label is named awaiting reply.

Process

# Make new dir for your app and switch to it
mkdir your-issues-closer-bot
cd your-issues-closer-bot
# Initialize git repo
git init
# Create an app on Heroku. See: heroku create --help
heroku apps:create your-issues-closer-bot
# Add heroku as remote to your git repo
heroku git:remote --app your-issues-closer-bot
# Fetch the latest no-carrier jar
curl -O -L https://github.com/twbs/no-carrier/releases/download/v1.0.0/no-carrier.jar
# Make special files to let Heroku know that you need Java 8
echo 'java.runtime.version=1.8' > system.properties

Create a pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <version>1.0-SNAPSHOT</version>
  <artifactId>issues-closer-bot</artifactId>
</project>
# Set env variables with user credentials (keep it in secret)
heroku config:set GITHUB_USERNAME=username GITHUB_PASSWORD=password
# Make a script to run NO CARRIER (see the "Usage" section in README: https://github.com/twbs/no-carrier#usage )
echo 'java -jar no-carrier.jar username/repository "awaiting reply" 14' > cron.daily.sh
chmod +x ./cron.daily.sh
# Add them all to git, push to Heroku and pray!
git add .
git commit -m 'Please work'
git push heroku master
# Check your cron script (it should print some data)
heroku run ./cron.daily.sh
# Add scheduler to your app
heroku addons:create scheduler:standard
# Setup our script to run daily; after the webpage opens, you need to input `./cron.daily.sh` into the form.
heroku addons:open scheduler

That's it!

Clone this wiki locally