github

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 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 github holds the values the GitHub client reads and the budget its callers spend: pull request states, explore candidates, rate limits and the priority a call is tagged with.

Index

Constants

View Source
const (
	StateOpen   = "OPEN"
	StateMerged = "MERGED"
	StateClosed = "CLOSED"
)

Variables

View Source
var ErrBudget = errors.New("GitHub budget low")

Functions

func WithPriority

func WithPriority(ctx context.Context, p Priority) context.Context

WithPriority tags ctx; an untagged call is PriorityUser.

Types

type BudgetError

type BudgetError struct {
	Limit    Limit
	Priority Priority
}

BudgetError is a call refused because its bucket fell below the floor of its priority.

func (*BudgetError) Error

func (e *BudgetError) Error() string

func (*BudgetError) Is

func (e *BudgetError) Is(target error) bool

type Candidate

type Candidate struct {
	Ref            pr.Ref    `json:"ref"`
	URL            string    `json:"url"`
	Title          string    `json:"title"`
	Author         string    `json:"author"`
	State          string    `json:"state"`
	IsDraft        bool      `json:"draft"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	Additions      int       `json:"additions"`
	Deletions      int       `json:"deletions"`
	ChangedFiles   int       `json:"changed_files"`
	HeadBranch     string    `json:"head"`
	BaseBranch     string    `json:"base"`
	ReviewDecision string    `json:"review_decision"`
	ReviewRequests []string  `json:"review_requests"` // logins and team:org/slug
	ChecksState    string    `json:"checks"`
	Comments       int       `json:"comments"`
	// MyReview is the viewer's latest review state, "" when none.
	MyReview       string `json:"my_review"`
	MyReviewOnHead bool   `json:"my_review_on_head"`
}

Candidate is a pull request Explore found, with what deciding whether to help on it needs.

type CandidatePage

type CandidatePage struct {
	Candidates []Candidate
	Total      int
	RateLimit  RateLimit
}

type Limit

type Limit struct {
	Resource         Resource
	Limit, Remaining int
	ResetAt          time.Time
}

Limit is one bucket as a response reported it.

type Priority

type Priority uint8

Priority orders who may spend the budget when it runs low.

const (
	PriorityUser       Priority = iota // a user action; keeps the reserve
	PriorityBackground                 // jobs, briefs, explore candidates
)

func PriorityOf

func PriorityOf(ctx context.Context) Priority

PriorityOf is the priority ctx is tagged with.

type RateLimit

type RateLimit struct {
	Cost      int       `json:"cost"`
	Remaining int       `json:"remaining"`
	Limit     int       `json:"limit"`
	ResetAt   time.Time `json:"reset_at"`
}

type Resource

type Resource string

Resource is a rate-limit bucket family, as x-ratelimit-resource names it.

const (
	ResourceGraphQL Resource = "graphql"
	ResourceCore    Resource = "core"
	ResourceSearch  Resource = "search"
)

Directories

Path Synopsis
Package change holds the rules that decide what a change to a pull request calls for: a follow-up, a triage round, a board move.
Package change holds the rules that decide what a change to a pull request calls for: a follow-up, a triage round, a board move.

Jump to

Keyboard shortcuts

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