Approve-CI
Approve-CI is a continuous integration tool that monitors pull requests made on GitHub and checks for approval from the rest of your team. The tool watches the comments made on your request for pre-configured ‘approve’ or ‘disapprove’ messages: when your team has reviewed the code and the number of approvals exceeds the number of disapprovals by a set amount, the check passes and request can be merged.
What’s the purpose? Well, at Enki we review all of our code changes using pull requests, only merging changes when they are approved by the other devs. We decided to formalise this (and save ourselves some work) by creating a bot. The review status of new features, bug fixes and other changes are now immediately obvious - and any accidental merges left by the wayside.
How to use?
Do you want to use it? Adding the tool to your repository is easy: just add a Webhook to your account or organisation, point the trigger at our deployment, and select the appropriate events!
- Go to
- your project on GitHub > Settings > Webhooks & services > Add Webhook or
- your organization on GitHub > Settings > Webhooks > Add Webhook
- Set the payload URL to
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 tool 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
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.
How To Contribute or Run Your Own?
Approve-CI is also super-customisable and hacker-friendly! If you want to tinker, the tool can be deployed in a few clicks using Heroku, deployed locally or containerised using Docker. If you want to use a different account for the tool, change the message or extend it with more functionalities, 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 tool using Heroku by pressing the button below:
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
Approve-CI is available under the MIT license.