repositoryevent

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package repositoryevent defines the public, privacy-safe contract used by the Workbench GitHub App to notify enrolled WB daemons about repository changes.

Index

Constants

View Source
const (
	ContractVersion = 1
	EventsPath      = "/v0/workbench/repository-events"
	AckPath         = "/v0/workbench/repository-events/ack"

	DefaultLimit       = 50
	MaxLimit           = 100
	DefaultWaitSeconds = 25
	MaxWaitSeconds     = 30
	MaxCursorBytes     = 1024
	MaxEventIDBytes    = 256
	MaxRepositoryBytes = 256
	MaxRefBytes        = 512
)

Variables

View Source
var (
	ErrInvalidEvent  = errors.New("invalid repository event")
	ErrInvalidCursor = errors.New("invalid repository event cursor")
)

Functions

func ValidateCursor

func ValidateCursor(cursor string, required bool) error

func ValidateEventID

func ValidateEventID(id string) error

func ValidateRepository

func ValidateRepository(repository string) error

Types

type AckRequest

type AckRequest struct {
	Version  int      `json:"version"`
	Cursor   string   `json:"cursor"`
	EventIDs []string `json:"event_ids"`
}

func (AckRequest) Validate

func (request AckRequest) Validate() error

type AckResponse

type AckResponse struct {
	Version int    `json:"version"`
	Cursor  string `json:"cursor"`
}

type Event

type Event struct {
	Version            int        `json:"version" firestore:"version"`
	ID                 string     `json:"id" firestore:"id"`
	Repository         string     `json:"repository" firestore:"repository"`
	PreviousRepository string     `json:"previous_repository,omitempty" firestore:"previous_repository,omitempty"`
	Ref                string     `json:"ref" firestore:"ref"`
	Reason             Reason     `json:"reason" firestore:"reason"`
	TargetSHA          string     `json:"target_sha,omitempty" firestore:"target_sha,omitempty"`
	OccurredAt         *time.Time `json:"occurred_at,omitempty" firestore:"occurred_at,omitempty"`
}

Event is the complete allowlist of GitHub metadata delivered to a WB daemon. It intentionally excludes webhook payloads, installation IDs, credentials, paths, actor identities, commit messages, and diagnostics.

func (Event) Validate

func (event Event) Validate() error

type PollResponse

type PollResponse struct {
	Version    int     `json:"version"`
	Cursor     string  `json:"cursor"`
	NextCursor string  `json:"next_cursor"`
	Events     []Event `json:"events"`
}

func (PollResponse) Validate

func (response PollResponse) Validate(requestCursor string) error

type Reason

type Reason string
const (
	ReasonDefaultBranchUpdated Reason = "default_branch_updated"
	ReasonRepositoryRenamed    Reason = "repository_renamed"
)

Jump to

Keyboard shortcuts

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