Skip to content

Konboi/ghooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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