Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. var githubhook = require('githubhook');
  2. var github = githubhook({/* options */});
  3.  
  4. github.listen();
  5.  
  6. var mergeRegex = /^Merge pull request (#\d)+ from/;
  7. github.on('*', function (event, repo, ref, data) {
  8. console.log('Hook received for',repo);
  9.  
  10. var head = data.head_commit;
  11.  
  12. var pusher = data.pusher.name;
  13.  
  14. var matches = mergeRegex.exec(head.message);
  15. if (matches === null) {
  16. console.log('commit pushed', head.id.substr(0,8));
  17. } else {
  18. console.log('Pull request merged', matches[1]);
  19. }
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement