Code Monkey home page Code Monkey logo

hookserve's Introduction

HookServe

http://godoc.org/github.com/chappjc/hookserve/hookserve

HookServe is a small golang utility for receiving github webhooks, originally by phayes. It's easy to use, flexible, and provides strong security though GitHub's HMAC webhook verification scheme.

server := hookserve.NewServer()
server.Port = 8888
server.Secret = "supersecretcode"
server.GoListenAndServe()

// Every time the server receives a webhook event, print the results
for event := range server.Events {
    fmt.Println(event.Owner + " " + event.Repo + " " + event.Branch + " " + event.Commit)
}

Command Line Utility

It also comes with a command-line utility that lets you pass webhook push events to other commands.

hookserve --port=8888 logger -t PushEvent #log github webhook push event to the system log (/var/log/message) via the logger command

Example output in response to a push event:

web hook received: event type push on chappjc/webfiles, branch master, [90b7cc2e3]
Launching command: /home/ubuntu/go/src/github.com/chappjc/webfiles/cmd/webfiles/relaunch.sh

Building From Source

First install Go, then:

go get -u github.com/chappjc/hookserve/util/hookserve

GitHub Webhooks

Setting up webhooks on GitHub is easy. Navigate to github.com/<name>/<repo>/settings/hooks and create a new webhook. Be sure to use application/json as the content type, and don't forget the /postreceive part of the Payload URL. Setting up your webhook should look something like this:

Configuring webhooks in GitHub

hookserve's People

Contributors

phayes avatar chappjc avatar hwhw avatar

Stargazers

Tom Ashley avatar

Watchers

Tom Ashley avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.