Skip to content

jaemk/notify-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

notify-hook

Build Status

Git post-receive hook to send GitHub PushEvent-formatted requests

Note, some github-specific payload fields are missing. The exact payload format can be found in payload.rs.

See releases for binaries, or build from source (see Releases section below). If you've installed a pre-compiled binary, you can update to the latest release via notify-hook self update.

Sidenote: This is a rewrite of the python utility notify-webhook


Configuration Options

Note: options are set (from within the git project) with:

git config notifyhook.hook-urls "https://httpbin.org/post,https://httpbin.org/post"

notifyhook.repo-name

Repository name to use. Defaults to blank


notifyhook.repo-description

Repository description to use. Defaults to blank


notifyhook.repo-owner-name

Repository owner name to use. Defaults to blank


notifyhook.repo-owner-email

Repository owner email to use. Defaults to blank


notifyhook.hook-urls

Comma separated list of urls to post content to.


notifyhook.secret-token

Optional: Hex encoded secret token used to generate a GitHub X-Hub-Signature header.


notifyhook.content-type

Content type to send payload as. Defaults to urlencoded.

Options:

  • urlencoded: (Default) Post as application/x-www-form-urlencoded
  • json: Post as application/json

Development

  • Install rust
  • cargo build
  • echo "6b1bc10c d7b4c1baba master" | cargo run -- --debug

Releases

Statically compiled releases are built by travis-ci with --features update to allow notify-hook self update. If you want to fork this project and continue building/self-updating with your github releases, you'll need to enable the notify-hook repository in your travis-ci account and then update the update function to point to your forked github repository.

If you prefer to build locally, there are two options:

  1. If your build and target architectures are identical, you can get away with a simple cargo build --release. Note, this requires libssl-dev to be installed in your build environment, and openssl installed on your target.
  2. If you want to build static releases, like those built by travis-ci, you can use the build-release.py script. This script requires docker and cross to be installed to produce statically compiled binaries. By default, artifacts will be produced for i686 and x86_64. This can be tweaked in the TARGETS list of build-release.py.
    • Install docker
      • Add yourself to the docker group: sudo usermod -a -G docker <user>
      • Restart to pick up changes (logging in & out may suffice)
      • You should be able to run docker version without any errors
      • May need to start the Docker daemon if it's not already running: sudo systemctl start docker
    • Install cross: cargo install cross
    • ./build-release.py
      • Release artifacts (i686 & x86_64) will be copied into bin/32 & bin/64