github

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 2 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	ID         int64  `json:"id"`
	Name       string `json:"name"`
	Status     string `json:"status"`
	Conclusion string `json:"conclusion"`
	URL        string `json:"url"`
	// StartedAt and CompletedAt are absent for commit statuses and for runs
	// that have not started or finished.
	StartedAt   *time.Time `json:"started_at,omitempty"`
	CompletedAt *time.Time `json:"completed_at,omitempty"`
}

type Comment

type Comment struct {
	ID        int64     `json:"id"`
	Author    string    `json:"author"`
	Body      string    `json:"body"`
	CreatedAt time.Time `json:"created_at"`
	Path      string    `json:"path,omitempty"`
	Line      int       `json:"line,omitempty"`
}

type Commit

type Commit struct {
	SHA       string    `json:"sha"`
	Message   string    `json:"message"`
	Author    string    `json:"author"`
	CreatedAt time.Time `json:"created_at"`
}

type CreatePullRequestRequest

type CreatePullRequestRequest struct {
	Repository string `json:"repository"`
	Title      string `json:"title"`
	Body       string `json:"body"`
	Head       string `json:"head"`
	Base       string `json:"base"`
	Draft      bool   `json:"draft"`
}

type File

type File struct {
	Path      string `json:"path"`
	Status    string `json:"status"`
	Additions int    `json:"additions"`
	Deletions int    `json:"deletions"`
	Patch     string `json:"patch"`
}

type GitHubService

type GitHubService interface {
	Repository(context.Context, string) (RemoteRepository, error)
	Branches(context.Context, string) ([]RemoteBranch, error)
	PullRequests(context.Context, string, PRFilter) ([]PullRequest, error)
	PullRequest(context.Context, string, int) (PullRequestDetail, error)
	CreatePullRequest(context.Context, CreatePullRequestRequest) (PullRequest, error)
	ReviewPullRequest(context.Context, ReviewRequest) error
	ReadyPullRequest(context.Context, string, int) error
	ClosePullRequest(context.Context, string, int) error
	ReopenPullRequest(context.Context, string, int) error
	MergePullRequest(context.Context, MergePullRequestRequest) error
	Comment(context.Context, string, int, string) error
	Checks(context.Context, string, string) ([]Check, error)
	WorkflowRuns(context.Context, string, string) ([]WorkflowRun, error)
}

type MergePullRequestRequest

type MergePullRequestRequest struct {
	Repository string `json:"repository"`
	Number     int    `json:"number"`
	Method     string `json:"method"`
	HeadSHA    string `json:"head_sha"`
}

type PRFilter

type PRFilter struct {
	State string
	Head  string
	Base  string
}

type PagedPullRequests added in v0.2.10

type PagedPullRequests interface {
	PullRequestPage(context.Context, string, PRFilter, int) (PullRequestPage, error)
}

PagedPullRequests is optional so provider adapters can migrate separately.

type PullRequest

type PullRequest struct {
	Number         int       `json:"number"`
	Title          string    `json:"title"`
	Body           string    `json:"body"`
	State          string    `json:"state"`
	Head           string    `json:"head"`
	HeadRepository string    `json:"head_repository,omitempty"`
	Base           string    `json:"base"`
	HeadSHA        string    `json:"head_sha"`
	URL            string    `json:"url"`
	Draft          bool      `json:"draft"`
	Author         string    `json:"author"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	NodeID         string    `json:"node_id"`
}

type PullRequestDetail

type PullRequestDetail struct {
	PullRequest
	Mergeable string `json:"mergeable"`
	// Additions, Deletions and ChangedFiles are GitHub's own totals, so they
	// stay correct when Files is truncated.
	Additions    int `json:"additions"`
	Deletions    int `json:"deletions"`
	ChangedFiles int `json:"changed_files"`
	// RequestedReviewers lists users whose review is still awaited.
	RequestedReviewers []string      `json:"requested_reviewers"`
	ReviewSummary      ReviewSummary `json:"review_summary"`
	// BehindBy is the number of base commits missing from head. Nil when it
	// is unknown or irrelevant (closed PRs).
	BehindBy *int      `json:"behind_by,omitempty"`
	Comments []Comment `json:"comments"`
	Reviews  []Review  `json:"reviews"`
	Commits  []Commit  `json:"commits"`
	Files    []File    `json:"files"`
}

type PullRequestPage added in v0.2.10

type PullRequestPage struct {
	Items    []PullRequest
	NextPage int
	// NotModified reports that GitHub answered the page with 304 Not Modified
	// and Items came from the client's conditional-request cache.
	NotModified bool
}

type RemoteBranch

type RemoteBranch struct {
	Name          string `json:"name"`
	RemoteHeadSHA string `json:"remote_head_sha"`
	Protected     bool   `json:"protected"`
}

type RemoteRepository

type RemoteRepository struct {
	ID            int64  `json:"id"`
	FullName      string `json:"full_name"`
	DefaultBranch string `json:"default_branch"`
	Private       bool   `json:"private"`
}

type Review

type Review struct {
	ID          int64     `json:"id"`
	Author      string    `json:"author"`
	State       string    `json:"state"`
	Body        string    `json:"body"`
	SubmittedAt time.Time `json:"submitted_at"`
}

type ReviewRequest

type ReviewRequest struct {
	Repository string `json:"repository"`
	Number     int    `json:"number"`
	Event      string `json:"event"`
	Body       string `json:"body"`
	CommitID   string `json:"commit_id,omitempty"`
}

type ReviewSummary added in v0.2.18

type ReviewSummary struct {
	Approvals        int `json:"approvals"`
	ChangesRequested int `json:"changes_requested"`
}

ReviewSummary counts each reviewer's standing verdict: their latest approving or changes-requesting review that has not been dismissed.

func SummarizeReviews added in v0.2.18

func SummarizeReviews(reviews []Review) ReviewSummary

SummarizeReviews expects reviews in chronological order, as GitHub lists them.

type WorkflowRun

type WorkflowRun struct {
	ID         int64  `json:"id"`
	Name       string `json:"name"`
	Branch     string `json:"branch"`
	HeadSHA    string `json:"head_sha"`
	Status     string `json:"status"`
	Conclusion string `json:"conclusion"`
	URL        string `json:"url"`
}

Directories

Path Synopsis
Package app implements GitHub's domain API without a gh executable.
Package app implements GitHub's domain API without a gh executable.
Compatibility names preserve CLI/TUI behavior while the daemon and web use the context-aware domain interfaces.
Compatibility names preserve CLI/TUI behavior while the daemon and web use the context-aware domain interfaces.

Jump to

Keyboard shortcuts

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