index.js
function handlePush(key, req, log, fn) {
  var body = req.body;
  var repo = body.repository;
  if (!body || !repo) return fn(new Error('missing body'));

  var url = repo.url;
  var name = repo.name;
  var ref = body.ref;
  var branch = ref.replace('refs/heads/', '');
  var sha = body.after;

  var info = {
    repo: repo.organization + '/' + repo.name,
    url: repo.url,
    name: repo.name,
    ref: ref,
    branch: branch,
    sha: sha,
    body: body
  };

  var event = body.deleted ? 'branch-deleted' : 'gh:parsed';
  fn(null, info, event);
}
function handlePush(key, req, log, fn) {
  var body = req.body;
  var repo = body.repository;
  if (!body || !repo) return fn(new Error('missing body'));

  var url = repo.url;
  var name = repo.name;
  var ref = body.ref;
  var branch = ref.replace('refs/heads/', '');
  var sha = body.after;

  var info = {
    repo: repo.organization + '/' + repo.name,
    url: repo.url,
    name: repo.name,
    ref: ref,
    branch: branch,
    sha: sha,
    body: body
  };

  var event = body.deleted ? 'branch-deleted' : 'gh:parsed';
  fn(null, info, event);
}
function handlePush ( key , req , log , fn ) { var body = req . body ; var repo = body . repository ; if ( ! body || ! repo ) return fn ( new Error ( 'missing body' ) ) ; var url = repo . url ; var name = repo . name ; var ref = body . ref ; var branch = ref . replace ( 'refs/heads/' , '' ) ; var sha = body . after ; var info = { repo : repo . organization + '/' + repo . name , url : repo . url , name : repo . name , ref : ref , branch : branch , sha : sha , body : body } ; var event = body . deleted ? 'branch-deleted' : 'gh:parsed' ; fn ( null , info , event ) ; }
Handle a push event

steps:
* git clone sha
* deploy the sha
* listen for success/failure and update the repo status (https://developer.github.com/v3/repos/statuses/)
* create a deployment (https://developer.github.com/v3/repos/deployments/#create-a-deployment)
Handle a push event