Documentation
¶
Overview ¶
Package github handles GitHub push webhook payloads.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DedupeCache ¶
type DedupeCache struct {
// contains filtered or unexported fields
}
Tracks recently seen GitHub delivery IDs to prevent a webhook from being processed more than once.
func NewDedupeCache ¶
func NewDedupeCache(capacity int) *DedupeCache
Creates a cache that remembers the last capacity delivery IDs.
func (*DedupeCache) Seen ¶
func (cache *DedupeCache) Seen(id string) bool
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
An http.Handler that accepts GitHub push webhooks on any path it is registered under. It validates the HMAC-SHA256 signature, deduplicates deliveries, parses the push payload, and dispatches asynchronously to onPush.
func NewHandler ¶
type PushPayload ¶
type PushPayload struct {
Ref string `json:"ref"`
After string `json:"after"`
Repository Repository `json:"repository"`
Commits []Commit `json:"commits"`
}
func ParsePushPayload ¶
func ParsePushPayload(data []byte) (*PushPayload, error)
func (*PushPayload) Branch ¶
func (payload *PushPayload) Branch() string
func (*PushPayload) ChangedFiles ¶
func (payload *PushPayload) ChangedFiles() []string
type Repository ¶
type Repository struct {
FullName string `json:"full_name"`
}
Click to show internal directories.
Click to hide internal directories.