Git web-hook receiver written in node.js. Created for prevent a routine work, such as working with database, static files, etc., after pushing changes to repo.
- nodejs >= v0.6.21
- OS: Linux(tested on Ubuntu, Debian), *BSD(Not tested)
There are two ways to install:
First, preferred way by installing from npm:
npm install -g gihook
Than you have command gihook
available.
Second is cloning repo and use it as:
git clone https://github.com/sashasimkin/gihook.git
cd gihook && chmod 0777 logs/
Than use it as forever app.js --params
or npm link .
than you have command gihook
available :-)
- Create file
{name}.json
with config object in directoryconfig/
(Or any other that you pass to script) (Below about its contents). - Start it as gihook 0.0.0.0:3000 --config path/to/configs/dir [--config path/to/config/file.json -c /some/other/file.json] ...
- Use
http://IP:PORT/{name}
as hook url in github, gitlab, etc.
If you want use it with forever ot anything such - start it as forever \
which gihook` [options ...]`
Write 'gihook -h' for more info.
Any endpoint has separated configuration which runs on each push.
It is file with json object inside in directory config/(By default, if you install from repo) or directories and files you specify.
Any file you pass to gihook must have .json
file extension.
path
- Root path for project, shell commands has been executed herecommands
- Array of shell commands, which will be performed after recieve hook (Supported {payload.} and {task.})refs
- payload.ref to match. String or array of strings which will be substituted to ref.match()
- Don't duplicate config names, in this case will be used config that loaded later
- For GitHub use
Just the push event.
setting. Payload version should bejson
. Other events currently not supported. - Payload which received by gihook must contain
payload.ref
key
- Write tests
- Look on this as alternative to own logger https://github.com/nomiddlename/log4js-node or this https://github.com/trentm/node-bunyan or https://github.com/flatiron/winston