Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rjz/githubhook
Github webhook parser in golang
https://github.com/rjz/githubhook
github github-hook github-webhooks golang
Last synced: 12 days ago
JSON representation
Github webhook parser in golang
- Host: GitHub
- URL: https://github.com/rjz/githubhook
- Owner: rjz
- License: other
- Created: 2015-10-19T03:48:45.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2023-12-26T16:16:59.000Z (11 months ago)
- Last Synced: 2024-11-02T00:50:23.854Z (19 days ago)
- Topics: github, github-hook, github-webhooks, golang
- Language: Go
- Size: 13.7 KB
- Stars: 53
- Watchers: 5
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
githubhook
===============================================Golang parser for [github webhooks][gh-webhook]. Not a server, though it could
be integrated with one.[![Go Report Card](https://goreportcard.com/badge/github.com/rjz/githubhook)](https://goreportcard.com/report/github.com/rjz/githubhook)
[![GoDoc](https://godoc.org/github.com/rjz/githubhook?status.svg)](https://godoc.org/github.com/rjz/githubhook)Installation
-----------------------------------------------```ShellSession
$ go get gopkg.in/rjz/githubhook.v0
```Usage
-----------------------------------------------Given an incoming `*http.Request` representing a webhook signed with a `secret`,
use `githubhook` to validate and parse its content:```go
secret := []byte("don't tell!")
hook, err := githubhook.Parse(secret, req)
```Plays nicely with the [google/go-github][gh-go-github] client!
```go
evt := github.PullRequestEvent{}
if err := json.Unmarshal(hook.Payload, &evt); err != nil {
fmt.Println("Invalid JSON?", err)
}
```[gh-webhook]: https://developer.github.com/webhooks/
[gh-go-github]: https://github.com/google/go-github