Versions in this module Expand all Collapse all v1 v1.1.0 Dec 26, 2025 v1.0.0 Dec 26, 2025 Changes in this version + var ErrBranchNotPushed = errors.New("branch not pushed to remote") + var ErrClosed = errors.New("pull request is closed") + var ErrExists = errors.New("pull request already exists for this branch") + var ErrMergeConflict = errors.New("merge conflict") + var ErrMerged = errors.New("pull request is already merged") + var ErrNoChanges = errors.New("no changes between branches") + var ErrNoProvider = errors.New("no PR provider configured") + var ErrNotFound = errors.New("pull request not found") + var ErrUnknownProvider = errors.New("unknown git provider") + func ContextWithProvider(ctx context.Context, p Provider) context.Context + func DetectProvider(remoteURL string) (string, error) + func ParseRepoFromURL(remoteURL string) (owner, repo string, err error) + type Builder struct + func NewBuilder(title string) *Builder + func (b *Builder) AsDraft() *Builder + func (b *Builder) Build() Options + func (b *Builder) WithAssignees(assignees ...string) *Builder + func (b *Builder) WithBase(base string) *Builder + func (b *Builder) WithBody(body string) *Builder + func (b *Builder) WithHead(head string) *Builder + func (b *Builder) WithLabels(labels ...string) *Builder + func (b *Builder) WithMetadata(key, value string) *Builder + func (b *Builder) WithMilestone(milestone string) *Builder + func (b *Builder) WithReviewers(reviewers ...string) *Builder + func (b *Builder) WithSummary(summary string, changes []string, testPlan string) *Builder + func (b *Builder) WithTicket(ticketID string) *Builder + type Filter struct + Author string + Base string + Direction string + Head string + Labels []string + Limit int + Sort string + State State + type GitHubProvider struct + func NewGitHubProvider(token, owner, repo string) (*GitHubProvider, error) + func NewGitHubProviderFromURL(token, remoteURL string) (*GitHubProvider, error) + func (p *GitHubProvider) AddComment(ctx context.Context, id int, body string) error + func (p *GitHubProvider) CreatePR(ctx context.Context, opts Options) (*PullRequest, error) + func (p *GitHubProvider) GetPR(ctx context.Context, id int) (*PullRequest, error) + func (p *GitHubProvider) ListPRs(ctx context.Context, filter Filter) ([]*PullRequest, error) + func (p *GitHubProvider) MergePR(ctx context.Context, id int, opts MergeOptions) error + func (p *GitHubProvider) RequestReview(ctx context.Context, id int, reviewers []string) error + func (p *GitHubProvider) UpdatePR(ctx context.Context, id int, opts UpdateOptions) (*PullRequest, error) + type GitLabProvider struct + func NewGitLabProvider(token, baseURL, projectID string) (*GitLabProvider, error) + func NewGitLabProviderFromURL(token, remoteURL string) (*GitLabProvider, error) + func (p *GitLabProvider) AddComment(ctx context.Context, id int, body string) error + func (p *GitLabProvider) CreatePR(ctx context.Context, opts Options) (*PullRequest, error) + func (p *GitLabProvider) GetPR(ctx context.Context, id int) (*PullRequest, error) + func (p *GitLabProvider) ListPRs(ctx context.Context, filter Filter) ([]*PullRequest, error) + func (p *GitLabProvider) MergePR(ctx context.Context, id int, opts MergeOptions) error + func (p *GitLabProvider) RequestReview(ctx context.Context, id int, reviewers []string) error + func (p *GitLabProvider) UpdatePR(ctx context.Context, id int, opts UpdateOptions) (*PullRequest, error) + type MergeMethod string + const MergeMethodMerge + const MergeMethodRebase + const MergeMethodSquash + type MergeOptions struct + CommitMessage string + CommitTitle string + DeleteBranch bool + Method MergeMethod + SHA string + type MockProvider struct + AddCommentFunc func(ctx context.Context, id int, body string) error + CreatePRFunc func(ctx context.Context, opts Options) (*PullRequest, error) + GetPRFunc func(ctx context.Context, id int) (*PullRequest, error) + ListPRsFunc func(ctx context.Context, filter Filter) ([]*PullRequest, error) + MergePRFunc func(ctx context.Context, id int, opts MergeOptions) error + RequestReviewFunc func(ctx context.Context, id int, reviewers []string) error + UpdatePRFunc func(ctx context.Context, id int, opts UpdateOptions) (*PullRequest, error) + func (m *MockProvider) AddComment(ctx context.Context, id int, body string) error + func (m *MockProvider) CreatePR(ctx context.Context, opts Options) (*PullRequest, error) + func (m *MockProvider) GetPR(ctx context.Context, id int) (*PullRequest, error) + func (m *MockProvider) ListPRs(ctx context.Context, filter Filter) ([]*PullRequest, error) + func (m *MockProvider) MergePR(ctx context.Context, id int, opts MergeOptions) error + func (m *MockProvider) RequestReview(ctx context.Context, id int, reviewers []string) error + func (m *MockProvider) UpdatePR(ctx context.Context, id int, opts UpdateOptions) (*PullRequest, error) + type Options struct + Assignees []string + Base string + Body string + Draft bool + Head string + Labels []string + Metadata map[string]string + Milestone string + Reviewers []string + Title string + type Provider interface + AddComment func(ctx context.Context, id int, body string) error + CreatePR func(ctx context.Context, opts Options) (*PullRequest, error) + GetPR func(ctx context.Context, id int) (*PullRequest, error) + ListPRs func(ctx context.Context, filter Filter) ([]*PullRequest, error) + MergePR func(ctx context.Context, id int, opts MergeOptions) error + RequestReview func(ctx context.Context, id int, reviewers []string) error + UpdatePR func(ctx context.Context, id int, opts UpdateOptions) (*PullRequest, error) + func MustProviderFromContext(ctx context.Context) Provider + func MustProviderFromEnv(remoteURL string) Provider + func ProviderFromContext(ctx context.Context) Provider + func ProviderFromEnv(remoteURL string) (Provider, error) + func ProviderFromEnvWithToken(remoteURL, token string) (Provider, error) + type PullRequest struct + Additions int + Assignees []string + Base string + Body string + ChangedFiles int + Commits int + CreatedAt time.Time + Deletions int + Draft bool + HTMLURL string + Head string + ID int + Labels []string + MergedAt *time.Time + MergedBy string + Reviewers []string + State State + Title string + URL string + UpdatedAt time.Time + type State string + const StateClosed + const StateMerged + const StateOpen + type UpdateOptions struct + Assignees []string + Base *string + Body *string + Draft *bool + Labels []string + Title *string