Skip to content

Instantly share code, notes, and snippets.

@MartijnR

MartijnR/webhook

Last active Aug 29, 2015
Embed
What would you like to do?
Webhook in Node
"use strict";
var gith = require( 'gith' ).create( 9001 ),
execFile = require('child_process').execFile;
gith( {
repo: 'enketo/enketo-core'
} ).on( 'all', function( payload ) {
console.log( 'Post-receive happened' );
if ( payload.branch === 'master' ) {
// Exec a shell script
execFile( './update.sh', function( error, stdout, stderr ) {
// Log success in some manner
console.log( 'enketo-core was updated and rebuilt!' );
} );
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment