Documentation
¶
Overview ¶
Package github implements the vcs.Provider interface for GitHub using the gh CLI.
Index ¶
- func ParseRepoURL(url string) (owner, repo string, err error)
- type Provider
- func (p *Provider) CheckStatus(ctx context.Context, worktreePath string, prNumber int) (*vcs.PRStatus, error)
- func (p *Provider) CheckStatusLight(ctx context.Context, worktreePath string, prNumber int) (*vcs.PRStatus, error)
- func (p *Provider) CreatePR(ctx context.Context, params vcs.CreateParams) (*vcs.PR, error)
- func (p *Provider) FetchCILogs(ctx context.Context, worktreePath string, checks []vcs.CICheck) (map[string]string, error)
- func (p *Provider) FetchPRChecks(ctx context.Context, worktreePath string, prNumber int) (string, []vcs.CICheck, error)
- func (p *Provider) FetchPendingReviewRequests(ctx context.Context, worktreePath string, prNumber int) ([]vcs.ReviewRequest, error)
- func (p *Provider) FetchReviewComments(ctx context.Context, worktreePath string, prNumber int) ([]vcs.ReviewComment, error)
- func (p *Provider) FetchUnresolvedThreadCount(ctx context.Context, worktreePath string, prNumber int) (int, error)
- func (p *Provider) GetRepoOwnerAndName(ctx context.Context, worktreePath string) (owner, repo string, err error)
- func (p *Provider) ListOpenPRs(ctx context.Context, worktreePath string) ([]vcs.OpenPR, error)
- func (p *Provider) MergePR(ctx context.Context, worktreePath string, prNumber int, strategy string) error
- func (p *Provider) Platform() vcs.Platform
- func (p *Provider) ResolveThread(ctx context.Context, worktreePath string, threadID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseRepoURL ¶
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 ¶
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 ¶
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 ¶
ListOpenPRs returns all open PRs in the repository.