-
Notifications
You must be signed in to change notification settings - Fork 28
/
doc.go
28 lines (21 loc) · 964 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
HookServe is a small golang utility for receiving github webhooks. 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()
for {
select {
case event := <-server.Events:
fmt.Println(event.Owner + " " + event.Repo + " " + event.Branch + " " + event.Commit)
default:
time.Sleep(100)
}
}
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
Settings up GitHub Webhooks
Setting up webhooks on github is easy. Navigate to `github.com/<name>/<repo>/settings/hooks` and create a new webhook.
*/
package hookserve