gh

package
v0.0.0-...-360d066 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 8 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 gh fetches the board's data from GitHub, reusing the session of the gh CLI through go-gh: gitboard never logs in on its own.

Index

Constants

View Source
const Limit = 50

Limit is how many rows each view loads.

Variables

This section is empty.

Functions

func SearchQuery

func SearchQuery(k Kind, login string) string

SearchQuery is the GitHub search string behind the PRs, Reviews and Issues views. Reviews drops your own PRs: those belong to PRs.

Types

type Check

type Check struct {
	Name     string // "Workflow / job" for Actions
	State    string // its conclusion once done (SUCCESS, FAILURE...), else its status (IN_PROGRESS, QUEUED...)
	Required bool   // branch protection needs it to pass
}

Check is one CI check of a PR's last commit: a check run (GitHub Actions and apps) or a commit status.

type Client

type Client struct {
	Login string
	// contains filtered or unexported fields
}

func New

func New() (*Client, error)

func (*Client) CommitFiles

func (c *Client) CommitFiles(repo, sha string) ([]string, error)

CommitFiles lists the files a commit touched, as "status path" lines.

func (*Client) Commits

func (c *Client) Commits() ([]Commit, error)

Commits uses the REST commit search, which only indexes each repo's default branch: a commit on a feature branch shows up once merged.

func (*Client) Issues

func (c *Client) Issues() ([]Issue, error)

func (*Client) NewerThan

func (c *Client) NewerThan(repo, rev string) (string, error)

NewerThan returns the tip of the repo's default branch when it comes after rev, and "" when it is rev, behind it, or rev is not on GitHub.

func (*Client) PRDetail

func (c *Client) PRDetail(repo string, number int) ([]Check, []Comment, error)

PRDetail returns the checks of a PR's last commit, and its comments and reviews, oldest first. ponytail: first 100 of each, paginate if a PR ever outgrows that.

func (*Client) PRs

func (c *Client) PRs(k Kind) ([]PR, error)

PRs serves both the PRs view (KindPRs) and the Reviews view (KindReviews).

func (*Client) Readme

func (c *Client) Readme(repo string) (string, error)

Readme returns the repo's README as markdown, or "" when it has none.

func (*Client) Repos

func (c *Client) Repos() ([]Repo, error)

Repos returns the repos the account owns, then the ones it collaborated on: a collaborator or org member, or someone who committed, opened PRs or issues, or reviewed there, in any year since the account was made. Owned ones have Owned set.

type Comment

type Comment struct {
	Author string
	Body   string
	State  string // review: APPROVED, CHANGES_REQUESTED, COMMENTED, DISMISSED, PENDING
	At     time.Time
	Inline []InlineComment
}

Comment is one entry of a PR's conversation: a plain comment (State "") or a review, with the comments it left on the code.

type Commit

type Commit struct {
	Repo    string
	SHA     string
	Message string
	URL     string
	Date    time.Time
}

type InlineComment

type InlineComment struct {
	Path string
	Line int // 0 when the line is gone from the diff
	Body string
}

type Issue

type Issue struct {
	Repo      string
	Number    int
	Title     string
	URL       string
	Body      string
	Labels    []string
	UpdatedAt time.Time
}

type Kind

type Kind int
const (
	KindPRs Kind = iota
	KindReviews
	KindIssues
)

type PR

type PR struct {
	Repo           string
	Number         int
	Title          string
	URL            string
	Body           string
	Draft          bool
	ReviewDecision string         // APPROVED, CHANGES_REQUESTED, REVIEW_REQUIRED or ""
	Checks         string         // SUCCESS, FAILURE, PENDING... or "" when there are none
	CheckCounts    map[string]int // how many checks are in each state (SUCCESS, FAILURE, SKIPPED...)
	Base, Head     string         // branch names: Head merges into Base
	Mergeable      string         // MERGEABLE, CONFLICTING or UNKNOWN
	MergeState     string         // CLEAN, DIRTY, BEHIND, BLOCKED, UNSTABLE, DRAFT, HAS_HOOKS or UNKNOWN
	UpdatedAt      time.Time
}

type Repo

type Repo struct {
	NameWithOwner string
	Name          string
	Description   string
	Language      string
	URL           string
	Private       bool
	Stars         int
	PushedAt      time.Time
	Owned         bool // false: a repo the account collaborated on
}

Jump to

Keyboard shortcuts

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