webhook

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	Hash string
	Time time.Time
}

func (Commit) Empty

func (c Commit) Empty() bool

func (Commit) Equals

func (c Commit) Equals(x Commit) bool

func (Commit) Verify

func (c Commit) Verify() error

type Config

type Config struct {
	Log logger.Interface
}

type Key

type Key struct {
	// Org is the organization name into which a commit was pushed.
	Org string

	// Rep is the repository name into which a commit was pushed.
	Rep string

	// Bra is the branch name into which a commit was pushed.
	Bra string
}

type Webhook

type Webhook struct {
	// contains filtered or unexported fields
}

func New

func New(c Config) *Webhook

func (*Webhook) Latest

func (w *Webhook) Latest(key Key, cmp Commit) Commit

Latest returns the most recent commit within a branch by comparing the already cached version, if any, with the compared version cmp. If the cache is empty for the underlying branch key, then cmp is returned.

func (*Webhook) Update

func (w *Webhook) Update(ctx context.Context, did string, nam string, eve *github.PushEvent) error

Update implements PushEventHandleFunc. We bind this method to the webhook endpoint that Github is POSTing push events to.

https://docs.github.com/en/webhooks/webhook-events-and-payloads#push
https://pkg.go.dev/github.com/cbrgm/githubevents/v2@v2.5.0/githubevents#PushEventHandleFunc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL