repositoryevent

package
v0.218.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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