Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

git-web-hooks

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-web-hooks

React to git webhooks.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

git-web-hooks

A module for reacting to git webhooks.

NPM

Example

const GitWebhooks = require('git-web-hooks')

new GitWebhooks({

	PORT: 3333 // optional. 3333 is default

}).on('payload', (req, res, payload) => {

	// do something based on payload contents
	
	// then send a response to github
	res.end('got it!')

})

Commands

Doing something useful with the webhooks probably means you will run some commands. GitWebhooks.command is a thin wrapper around child_process.exec that returns a promise. You can use this to run commands like git pull or npm install.


var cmd = GitWebhooks.command('echo "running a command now!"')

// it's a Promise!
cmd.then(std => {
	console.log(std.out, std.err)
}).catch(err => console.error)

// and you can pass options to child_process.exec
GitWebhooks.command('echo "Hello, options!"', {maxBuffer: 1024*1024})


Daemonize

To keep the process alive, you should use a daemonizer like nohup, forever, pm2, or others.

nohup your-hook-server.js &

forever start your-hook-server.js

pm2 start your-hook-server.js

Keywords

FAQs

Package last updated on 21 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc