All Projects → Konboi → ghooks

Konboi / ghooks

Licence: MIT License
github hooks receiver written by golang

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

ghooks

ghooks is github hooks receiver. inspired by GitHub::Hooks::Receiver, octoks

Install

go get github.com/Konboi/ghooks

Usage

// sample.go
package main

import (
    "fmt"
    "log"

    "github.com/Konboi/ghooks"
)


func main() {
    port := 8080
    hooks := ghooks.NewServer(port)

    hooks.On("push", pushHandler)
    hooks.On("pull_request", pullRequestHandler)
    hooks.Run()
}

func pushHandler(payload interface{}) {
    fmt.Println("puuuuush")
}

func pullRequestHandler(payload interface{}) {
    fmt.Println("pull_request")
}
go run sample.go
curl -H "X-GitHub-Event: push" -d '{"hoge":"fuga"}' http://localhost:8080
> puuuuush
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].