github

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package github implements the vcs.Provider interface for GitHub using the gh CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRepoURL

func ParseRepoURL(url string) (owner, repo string, err error)

ParseRepoURL parses a git remote URL into owner and repository name.

Types

type Provider

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

Provider implements vcs.Provider for GitHub using the gh CLI.

func New

func New(db *state.DB) *Provider

New creates a GitHub VCS provider. The state DB is optional (may be nil); when non-nil, CreatePR records the PR and runs an initial mergeability check.

func (*Provider) CheckStatus

func (p *Provider) CheckStatus(ctx context.Context, worktreePath string, prNumber int) (*vcs.PRStatus, error)

CheckStatus gets the full status of a PR via gh pr view and GraphQL.

func (*Provider) CheckStatusLight

func (p *Provider) CheckStatusLight(ctx context.Context, worktreePath string, prNumber int) (*vcs.PRStatus, error)

CheckStatusLight gets the review-request and mergeable state of a PR without fetching unresolved thread counts (which requires expensive GraphQL pagination).

func (*Provider) CreatePR

func (p *Provider) CreatePR(ctx context.Context, params vcs.CreateParams) (*vcs.PR, error)

CreatePR creates a pull request using the gh CLI and optionally records it in the state DB when a DB was provided at construction time.

func (*Provider) FetchCILogs

func (p *Provider) FetchCILogs(ctx context.Context, worktreePath string, checks []vcs.CICheck) (map[string]string, error)

FetchCILogs fetches CI logs for failing checks from GitHub Actions. Returns a map of check name → log output.

func (*Provider) FetchPRChecks

func (p *Provider) FetchPRChecks(ctx context.Context, worktreePath string, prNumber int) (string, []vcs.CICheck, error)

FetchPRChecks returns the raw output of `gh pr checks` and the parsed failing checks for a PR.

func (*Provider) FetchPendingReviewRequests

func (p *Provider) FetchPendingReviewRequests(ctx context.Context, worktreePath string, prNumber int) ([]vcs.ReviewRequest, error)

FetchPendingReviewRequests uses GraphQL to check for pending review requests, including Bot reviewers (e.g., copilot-pull-request-reviewer) that the gh CLI's --json reviewRequests field does not serialize.

func (*Provider) FetchReviewComments

func (p *Provider) FetchReviewComments(ctx context.Context, worktreePath string, prNumber int) ([]vcs.ReviewComment, error)

FetchReviewComments returns review comments and unresolved threads on a PR via GraphQL and the gh CLI.

func (*Provider) FetchUnresolvedThreadCount

func (p *Provider) FetchUnresolvedThreadCount(ctx context.Context, worktreePath string, prNumber int) (int, error)

FetchUnresolvedThreadCount uses the GraphQL API to count unresolved review threads.

func (*Provider) GetRepoOwnerAndName

func (p *Provider) GetRepoOwnerAndName(ctx context.Context, worktreePath string) (owner, repo string, err error)

GetRepoOwnerAndName extracts the owner and repository name from git remote origin.

func (*Provider) ListOpenPRs

func (p *Provider) ListOpenPRs(ctx context.Context, worktreePath string) ([]vcs.OpenPR, error)

ListOpenPRs returns all open PRs in the repository.

func (*Provider) MergePR

func (p *Provider) MergePR(ctx context.Context, worktreePath string, prNumber int, strategy string) error

MergePR merges a PR using the gh CLI with the specified strategy. Valid strategies: "squash", "merge", "rebase". Defaults to "squash" if empty.

func (*Provider) Platform

func (p *Provider) Platform() vcs.Platform

Platform returns vcs.GitHub.

func (*Provider) ResolveThread

func (p *Provider) ResolveThread(ctx context.Context, worktreePath string, threadID string) error

ResolveThread resolves a review thread on a GitHub PR via GraphQL.

Jump to

Keyboard shortcuts

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