/approve-ci

:+1: Monitor pull requests and check for approval

Primary LanguageJavaScript

approve-ci

build status Heroku

Approve-ci monitors pull requests and checks for approval. Once the number of approvals exceeds the number of disapprovals by a set amount the pull request is marked as 'approved' and is ready to merge.

approve-ci in use

How To Use?

  • Go to
  • your project on GitHub > Settings > Webhooks & services > Add Webhook or
  • your organization on GitHub > Settings > Webhooks > Add Webhook
  • Payload URL: (https://approve-ci.herokuapp.com/)
  • Let me select individual events > Check repo
  • Add Webhook

And you are done. Next time a pull request is opened, you should see the pending status from approve-ci ;)

Configuration

The bot can be configured by adding a .approve-ci file to the base directory of the repo. Here's a list of the possible options:

{
  "name": "approve-ci",
  "approvalCount": 1,
  "approvalStrings": ["%F0%9F%91%8D", ":+1:", ":thumbsup:"],
  "disapprovalStrings": ["%F0%9F%91%8E", ":-1:", ":thumbsdown:"],
  "approveString": "The pull request was approved",
  "rejectString": "The pull request needs more work",
  "pendingString": "Waiting for approval"
}

When using emojis you must URI encodeURI them (as shown above for 👍 and 👎).

Protected branches

GitHub allows you protect branches and to require specific tests to pass before pull requests can be merged. You can set this up by visiting https://github.com/USERNAME/REPO/settings/branches, selecting the branch you want to protect and then checking the approve-ci bot (the name is defined in the configuration file, see the next section), approval is needed before a request can be merged.

Protected branches

How To Contribute or Run Your Own Bot?

If you want to use a different account for the bot, change the message or extend it to provide additional functionality, we've tried to make it super easy:

git clone https://github.com/enkidevs/approve-ci.git
cd approve-ci
npm install
npm start
# Follow the instructions there

Alternatively you can deploy the bot using Heroku by pressing the button below:

Deploy

Or you can build and deploy on your servers using Docker:

docker build -t approve-ci .
docker run -d -p 80:3000 -e GITHUB_TOKEN=<YOUR_GITHUB_TOKEN_HERE> approve-ci

License

MIT