Skip to content

express middleware to automatically update and restart an application based on github/gitlab webhook.

Notifications You must be signed in to change notification settings

clive-io/uphook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uphook

express middleware to automatically update and restart an application based on github/gitlab webhook.

npm install --save uphook

usage

if verified hook on right branch, git force-pulls to current branch and calls the callback.

let hook = require('uphook').github({
  secret: process.env.GH_SECRET,
  verify: function(req, res){
    return true;
    //before it calls gitupdate(), can return false to cancel that.
  },
  callback: function(err, payload){
    if(!err)
      process.exit(0); //lets PM2 restart the process
  }
});
app.use('/gh-update', hook);

note that you should definitely use SSL because GitLab doesn't have HMAC, which is dumb.

About

express middleware to automatically update and restart an application based on github/gitlab webhook.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published