Skip to content

Go bindings for the Github Events that supports protocol buffers

License

Notifications You must be signed in to change notification settings

jhaynie/go-github-protobuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Bindings for Github API protobuf

This project contains the Go bindings for the protobuf definition files for entities and events in the Github API. This bindings generated from the jhaynie/github-protobuf project.

Install

import "github.com/jhaynie/go-github-protobuf/github"

Usage

Parse an incoming Github WebHook event and convert to the appropriate event class:

// r is the http request
payload, err := github.ValidatePayload(r, "your secret")
if err != nil {
	// error
}
event, err := github.ParseWebHook(github.WebHookType(r), payload)
if err != nil {
	// handle error
}
switch event := event.(type) {
	case CommitCommentEvent:
	    processCommitCommentEvent(event)
	case CreateEvent:
	    processCreateEvent(event)
}

License

Licensed under the MIT License.