github

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 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, the PRs you review and the issues assigned to you through the gh CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LatestRelease added in v0.2.0

func LatestRelease(repo string) (string, error)

LatestRelease returns the tag of repo's (owner/name) latest GitHub release, e.g. v0.2.0.

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() (Snapshot, error)

Fetch returns your login, your open PRs, the open PRs you review, your assigned issues 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 Issue added in v0.1.3

type Issue struct {
	Repo      string // owner/name
	RepoName  string // name
	Number    int
	Title     string
	URL       string
	Author    string
	Body      string
	Labels    []string
	Comments  int
	CreatedAt time.Time
	UpdatedAt time.Time
	// Linked are the PRs GitHub links to the issue (its Development section, or
	// "Closes #N" in a PR), oldest first. Closed unmerged PRs are left out.
	Linked []LinkedPR
}

Issue is an open issue assigned to you.

func (Issue) Key added in v0.1.3

func (i Issue) Key() string

Key identifies an issue across refreshes; it never collides with a PR key because issues and PRs share one number sequence per repo.

type LinkedPR added in v0.2.0

type LinkedPR struct {
	Repo    string // owner/name
	Number  int
	URL     string
	State   string // OPEN or MERGED
	IsDraft bool
}

LinkedPR is a PR linked to an issue.

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
	// MyLastReview is when you last submitted a review; only for PRs you review.
	MyLastReview 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 Snapshot added in v0.1.3

type Snapshot struct {
	Login  string
	Mine   []PR // your open PRs
	Review []PR // open PRs you review
	Issues []Issue
	Rate   RateLimit
}

Snapshot is one poll's result.

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 are requested and have not reviewed it yet
	StatusReRequested     // review section: you reviewed it and were requested again
	StatusReviewedUpdated // review section: new commits since your last review, no new request
	StatusReviewed        // review section: you reviewed the current head, no new request
)

func (Status) Actionable

func (s Status) Actionable() bool

Actionable reports whether Enter should start an agent for a PR in this status. A PR you review only needs you while GitHub lists you as a requested reviewer.

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
	// OnReviewer: the next move is the reviewer's, because the PR author wrote the
	// thread's last comment or re-requested a review from whoever did.
	OnReviewer bool
}

Jump to

Keyboard shortcuts

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