octoturtle
v1.0.0
Published
Set up auditing rules for your Github repository
Downloads
6
Maintainers
Readme
Octoturtle
Octoturtle is a dead simple fluent library for responding to Github webhooks. Primarily inspired by Docker's awesome issue and PR auditor @GordonTheTurtle, Octoturtle seeks to make it easy for any repository owner to specify and enforce a set of rules for contributing to a repository.
Here's a simple Octoturtle rule based on Docker's #dibs policy for claiming issues:
const octoturtle = require('octoturtle');
const config = require('./config.json');
const whenAn = octoturtle;
const github = new octoturtle.Github(config.GITHUB_USER, config.GITHUB_TOKEN);
const hook = whenAn('issues').is('opened').to('octoturtle');
/**
* Checks if the body of the item contains the string "dibs".
* @param {String} event The type of event
* @param {Payload} payload The hook payload
*/
function bodyContainsDibs(event, payload) {
payload.getIssueBody().includes('dibs');
}
hook.if(bodyContainsDibs, github.applyLabels(['dibs']));
Installation
You can deploy your own Octoturtle auditor easily using either Express or with Lambda using Gordon.
First, install Yeoman and generator-octoturtle using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-octoturtle
Then generate your new auditor:
yo octoturtle