Skip to content

Instantly share code, notes, and snippets.

@hansott
Last active August 29, 2015 14:19
Show Gist options
  • Save hansott/0cde1a26e5851e6107b2 to your computer and use it in GitHub Desktop.
Save hansott/0cde1a26e5851e6107b2 to your computer and use it in GitHub Desktop.
Gitlab Web Hook using Node.js
1. `$ npm install gitlabhook`
2. Copy webhook.js in directory
3. Create systemd service, instructions can be found here: https://github.com/rolfn/node-gitlab-hook#installation-hints-for-linux
4. Or test using `node webhook.js`
var gitlabhook = require('gitlabhook');
var util = require('util');
var exec = require('child_process').exec;
var child;
var gitlab = gitlabhook({}, function() {
child = exec('cd .. && cd wmd1415_project2 && git pull', function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
if (err !== null) {
console.log(err);
}
});
});
gitlab.listen();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment