github

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT 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 loads your open PRs and the PRs you review through the gh CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Name  string
	State CheckState
}

type CheckState

type CheckState int

CheckState is a CI check result normalized across CheckRun and StatusContext.

const (
	CheckPass CheckState = iota
	CheckFail
	CheckPending
	CheckSkip
)

type Fetcher

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

Fetcher keeps full PR data between polls and re-fetches only PRs that changed. It is used by one poll at a time.

func NewFetcher

func NewFetcher() *Fetcher

func (*Fetcher) Fetch

func (f *Fetcher) Fetch() (login string, mine, review []PR, rate RateLimit, err error)

Fetch returns your login, your open PRs, the open PRs you review, and the rate limit. A PR is re-fetched when it is new, its updatedAt moved, or its CI was still running (check results do not move updatedAt).

type PR

type PR struct {
	Repo      string // owner/name
	RepoName  string // name
	Number    int
	Title     string
	URL       string
	Author    string
	Branch    string
	Base      string
	HeadOID   string
	IsDraft   bool
	Decision  string // APPROVED, CHANGES_REQUESTED, REVIEW_REQUIRED or ""
	CI        string // rollup: SUCCESS, FAILURE, PENDING, ERROR, EXPECTED or ""
	Checks    []Check
	Reviewers []Reviewer
	Threads   []Thread // unresolved only
	UpdatedAt time.Time
	// LastCommit is when the head commit was made: how long the PR has waited since the last push.
	LastCommit time.Time
	// LastFeedback is the newest review or comment by a human other than the author.
	LastFeedback time.Time
	Status       Status
	Mine         bool
	IsBot        bool // author is a bot (dependabot, renovate, …)
}

func (PR) Key

func (p PR) Key() string

Key identifies a PR across refreshes.

func (PR) Open

func (p PR) Open() int

func (PR) Unresolved

func (p PR) Unresolved() int

Unresolved counts every open thread; Open counts only those waiting on the PR author.

type RateLimit

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

RateLimit is the GraphQL budget left this hour (5,000 points for a user).

func FetchRateLimit

func FetchRateLimit() (RateLimit, error)

FetchRateLimit reads the GraphQL budget over REST, which does not spend GraphQL points and still answers when the GraphQL budget is exhausted.

type Reviewer

type Reviewer struct {
	Login string
	State string // APPROVED, CHANGES_REQUESTED, COMMENTED, DISMISSED, REQUESTED
}

type Status

type Status int

Status is the dashboard's verdict on a PR.

const (
	StatusDraft Status = iota
	StatusInReview
	StatusNeedsWork
	StatusApproved
	StatusToReview        // review section: you have not reviewed it yet
	StatusReviewedUpdated // review section: new commits since your last review
	StatusReviewed        // review section: you reviewed the current head
)

func (Status) Actionable

func (s Status) Actionable() bool

Actionable reports whether Enter should start an agent for a PR in this status.

func (Status) Label

func (s Status) Label() string

func (Status) Urgency

func (s Status) Urgency() int

Urgency orders statuses for the "urgent" sort: lower comes first.

type Thread

type Thread struct {
	Author string
	Path   string
	Line   int
	Body   string
	// Replied: the PR author wrote the thread's last comment, so the next move is the reviewer's.
	Replied bool
}

Jump to

Keyboard shortcuts

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