Skip to content

Instantly share code, notes, and snippets.

@MartijnR
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartijnR/38621b556356111e87a2 to your computer and use it in GitHub Desktop.
Save MartijnR/38621b556356111e87a2 to your computer and use it in GitHub Desktop.
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