Versions in this module Expand all Collapse all v0 v0.0.8 May 18, 2026 v0.0.7 May 11, 2026 v0.0.6 May 8, 2026 Changes in this version + var ErrBranchProtectionPermissionDenied = errors.New("insufficient permissions to read branch protection rules") type Client + func (c *Client) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) ([]RequiredCheck, error) + func (c *Client) GetRequiredStatusChecksForCurrentRepo(ctx context.Context, branch string) ([]RequiredCheck, error) + func (c *Client) MergePullRequest(ctx context.Context, owner, repo string, number int, opts *MergeOptions) (*MergeResult, error) + func (c *Client) MergePullRequestForCurrentRepo(ctx context.Context, number int, opts *MergeOptions) (*MergeResult, error) + type MergeConflictError struct + Err error + func (e *MergeConflictError) Error() string + func (e *MergeConflictError) Unwrap() error + type MergeMethodNotAllowedError struct + Err error + Method string + func (e *MergeMethodNotAllowedError) Error() string + func (e *MergeMethodNotAllowedError) Unwrap() error + type MergeOptions struct + CommitMessage string + CommitTitle string + ExpectedHeadSHA string + Method string + type MergeResult struct + Merged bool + Message string + SHA string + type NotMergeableError struct + Err error + Reason string + func (e *NotMergeableError) Error() string + func (e *NotMergeableError) Unwrap() error type PRCheck + App ... type PullRequest + Body string + type RequiredCheck struct + AppID *int + Context string v0.0.5 Apr 25, 2026 v0.0.4 Apr 24, 2026 v0.0.3 Feb 18, 2026 v0.0.2 Nov 18, 2025 v0.0.1 Nov 12, 2025 Changes in this version + const DefaultBaseDelay + const DefaultCacheTTL + const DefaultMaxDelay + const DefaultMaxRetries + const DefaultTimeout + func DetectBaseChanged(existingPR *PullRequest, detectedBase string) bool + func DetectRebase(existingPR *PullRequest, currentBaseSHA string) bool + func DetectReviewerConflicts(currentReviewers []string, parentPR *PullRequest) []string + func FormatReviewerAssignment(assignment *ReviewerAssignment, parentPR *PullRequest, inherited bool) string + func FormatStackingMetadata(parentPR *PullRequest) string + func GenerateCacheKey(method, path string, params map[string]string) string + func IsAuthenticationError(err error) bool + func IsAuthorizationError(err error) bool + func IsCircularDependencyError(err error) bool + func IsInvalidBaseError(err error) bool + func IsNotFoundError(err error) bool + func IsParentPRConflictError(err error) bool + func IsRateLimitError(err error) bool + func IsRetryableError(err error) bool + func IsStackingError(err error) bool + func IsValidationError(err error) bool + func ParseErrorResponse(errResp *ErrorResponse) error + func RetryWithBackoff(ctx context.Context, policy *RetryPolicy, fn RetryFunc) (*http.Response, error) + func ShouldRetry(resp *http.Response, err error) bool + type AssignReviewersRequest struct + Reviewers []string + TeamReviewers []string + type AuthenticationError struct + Err error + Message string + func NewAuthenticationError(message string, err error) *AuthenticationError + func (e *AuthenticationError) Error() string + func (e *AuthenticationError) Unwrap() error + type AuthorizationError struct + Err error + Message string + Resource string + func NewAuthorizationError(message string, resource string, err error) *AuthorizationError + func (e *AuthorizationError) Error() string + func (e *AuthorizationError) Unwrap() error + type Cache interface + Clear func() + Delete func(key string) + Get func(key string) (value interface{}, found bool) + GetETag func(key string) (etag string, found bool) + Set func(key string, value interface{}, ttl time.Duration) + SetWithETag func(key string, value interface{}, etag string, ttl time.Duration) + Stats func() CacheStats + type CacheStats struct + Evictions int64 + HitRate float64 + Hits int64 + Misses int64 + Size int + type CircuitBreaker struct + func NewCircuitBreaker(maxFailures int, resetTimeout time.Duration) *CircuitBreaker + func (cb *CircuitBreaker) Allow() bool + func (cb *CircuitBreaker) RecordFailure() + func (cb *CircuitBreaker) RecordSuccess() + func (cb *CircuitBreaker) State() CircuitState + type CircuitState int + const CircuitClosed + const CircuitHalfOpen + const CircuitOpen + type CircularDependencyError struct + Branches []string + ConflictingPR int + CurrentPR int + Err error + Message string + func NewCircularDependencyError(message string, branches []string, currentPR, conflictingPR int, err error) *CircularDependencyError + func (e *CircularDependencyError) Error() string + func (e *CircularDependencyError) Unwrap() error + type Client struct + func NewClient(opts ...ClientOption) (*Client, error) + func (c *Client) AssignReviewers(ctx context.Context, owner, repo string, number int, users, teams []string) error + func (c *Client) AssignReviewersForCurrentRepo(ctx context.Context, number int, users, teams []string) error + func (c *Client) CacheStats() CacheStats + func (c *Client) CheckDraftTransition(ctx context.Context, owner, repo string, pr *PullRequest) (*DraftTransitionResult, error) + func (c *Client) CheckDraftTransitionForCurrentRepo(ctx context.Context, pr *PullRequest) (*DraftTransitionResult, error) + func (c *Client) ClearCache() + func (c *Client) Close() error + func (c *Client) ConvertPRToDraft(ctx context.Context, owner, repo string, pr *PullRequest) (*PullRequest, error) + func (c *Client) ConvertPRToDraftForCurrentRepo(ctx context.Context, pr *PullRequest) (*PullRequest, error) + func (c *Client) CreatePullRequest(ctx context.Context, owner, repo string, title, head, base, body string, ...) (*PullRequest, error) + func (c *Client) CreatePullRequestForCurrentRepo(ctx context.Context, title, head, base, body string, draft bool, ...) (*PullRequest, error) + func (c *Client) CurrentUser(ctx context.Context) (*User, error) + func (c *Client) Do(ctx context.Context, method, path string, body interface{}, ...) error + func (c *Client) DoGraphQL(ctx context.Context, query string, variables map[string]interface{}, ...) error + func (c *Client) EnrichPullRequest(ctx context.Context, owner, repo string, pr *PullRequest) error + func (c *Client) EnrichPullRequests(ctx context.Context, owner, repo string, prs []*PullRequest) error + func (c *Client) FindDependentPRs(ctx context.Context, owner, repo, baseBranch string) ([]*PullRequest, error) + func (c *Client) FindDependentPRsForCurrentBranch(ctx context.Context, branchName string) ([]*PullRequest, error) + func (c *Client) FindExistingPR(ctx context.Context, owner, repo, branchName string) (*PullRequest, error) + func (c *Client) FindExistingPRForCurrentBranch(ctx context.Context, branchName string) (*PullRequest, error) + func (c *Client) GetCurrentRepositoryPullRequests(ctx context.Context, opts *PullRequestListOptions) ([]*PullRequest, error) + func (c *Client) GetCurrentRepositoryPullRequestsWithPagination(ctx context.Context, opts *PullRequestListOptions) ([]*PullRequest, error) + func (c *Client) GetCurrentUser(ctx context.Context) (string, error) + func (c *Client) GetPullRequestChecks(ctx context.Context, owner, repo, sha string) ([]PRCheck, error) + func (c *Client) GetPullRequestRequestedReviewers(ctx context.Context, owner, repo string, number int) ([]PRReviewer, error) + func (c *Client) GetPullRequestReviews(ctx context.Context, owner, repo string, number int) ([]PRReview, error) + func (c *Client) GetPullRequests(ctx context.Context, owner, repo string, opts *PullRequestListOptions) ([]*PullRequest, error) + func (c *Client) GetPullRequestsRaw(ctx context.Context, owner, repo string, opts *PullRequestListOptions) ([]*PullRequest, *http.Response, error) + func (c *Client) GetPullRequestsWithPagination(ctx context.Context, owner, repo string, opts *PullRequestListOptions) ([]*PullRequest, error) + func (c *Client) GraphQL() *api.GraphQLClient + func (c *Client) HandleStackedPRUpdate(ctx context.Context, existingPR *PullRequest, detectedBase string, ...) (*StackedPRUpdateResult, error) + func (c *Client) InvalidateCacheKey(key string) + func (c *Client) MarkPRReadyForReview(ctx context.Context, owner, repo string, pr *PullRequest) (*PullRequest, error) + func (c *Client) MarkPRReadyForReviewForCurrentRepo(ctx context.Context, pr *PullRequest) (*PullRequest, error) + func (c *Client) REST() *api.RESTClient + func (c *Client) Repository() *Repository + func (c *Client) UpdatePRBase(ctx context.Context, owner, repo string, number int, newBase string) error + func (c *Client) UpdatePRBaseForCurrentRepo(ctx context.Context, number int, newBase string) error + func (c *Client) UpdatePullRequest(ctx context.Context, owner, repo string, number int, title, body string, ...) (*PullRequest, error) + func (c *Client) UpdatePullRequestForCurrentRepo(ctx context.Context, number int, title, body string, draft *bool, ...) (*PullRequest, error) + func (c *Client) VerifyAuthentication(ctx context.Context) error + type ClientOption func(*Client) error + func WithBaseDelay(delay time.Duration) ClientOption + func WithCache(cache Cache) ClientOption + func WithCacheTTL(ttl time.Duration) ClientOption + func WithConfig(config *Config) ClientOption + func WithHTTPClient(httpClient *http.Client) ClientOption + func WithMaxDelay(delay time.Duration) ClientOption + func WithMaxRetries(maxRetries int) ClientOption + func WithRepository(owner, name string) ClientOption + func WithTimeout(timeout time.Duration) ClientOption + func WithoutCache() ClientOption + type Config struct + BaseDelay time.Duration + CacheTTL time.Duration + EnableCache bool + HTTPClient *http.Client + MaxDelay time.Duration + MaxRetries int + Timeout time.Duration + func DefaultConfig() *Config + type CreatePRRequest struct + Base string + Body string + Draft bool + Head string + MaintainerCanModify bool + Title string + type DraftTransitionResult struct + BlockingReasons []string + CanTransition bool + DependentPRCount int + DependentPRsDraft bool + DependentPRsOpen bool + type ErrorResponse struct + DocumentationURL string + Errors []FieldError + Message string + StatusCode int + func (e *ErrorResponse) Error() string + type FieldError struct + Code string + Field string + Message string + type GitHubClient interface + Do func(ctx context.Context, method, path string, body interface{}, ...) error + DoGraphQL func(ctx context.Context, query string, variables map[string]interface{}, ...) error + GraphQL func() *api.GraphQLClient + REST func() *api.RESTClient + Repository func() *Repository + type InvalidBaseError struct + BaseBranch string + Err error + Message string + ValidBases []string + func NewInvalidBaseError(message string, baseBranch string, validBases []string, err error) *InvalidBaseError + func (e *InvalidBaseError) Error() string + func (e *InvalidBaseError) Unwrap() error + type MemoryCache struct + func NewMemoryCache(cleanupInterval time.Duration) *MemoryCache + func (m *MemoryCache) Clear() + func (m *MemoryCache) Delete(key string) + func (m *MemoryCache) Get(key string) (interface{}, bool) + func (m *MemoryCache) GetETag(key string) (string, bool) + func (m *MemoryCache) Set(key string, value interface{}, ttl time.Duration) + func (m *MemoryCache) SetWithETag(key string, value interface{}, etag string, ttl time.Duration) + func (m *MemoryCache) Stats() CacheStats + func (m *MemoryCache) Stop() + type NoOpCache struct + func (n *NoOpCache) Clear() + func (n *NoOpCache) Delete(key string) + func (n *NoOpCache) Get(key string) (interface{}, bool) + func (n *NoOpCache) GetETag(key string) (string, bool) + func (n *NoOpCache) Set(key string, value interface{}, ttl time.Duration) + func (n *NoOpCache) SetWithETag(key string, value interface{}, etag string, ttl time.Duration) + func (n *NoOpCache) Stats() CacheStats + type NotFoundError struct + Err error + Message string + Resource string + func NewNotFoundError(message string, resource string, err error) *NotFoundError + func (e *NotFoundError) Error() string + func (e *NotFoundError) Unwrap() error + type PRBranch struct + Ref string + Repo PRRepository + SHA string + type PRCheck struct + CompletedAt time.Time + Conclusion string + ID int + Name string + StartedAt time.Time + Status string + type PRRepository struct + FullName string + Name string + Owner PRUser + type PRReview struct + ID int + State string + SubmittedAt time.Time + User PRUser + type PRReviewer struct + Login string + Type string + type PRStatus struct + CheckStatus string + ReviewStatus string + func DeterminePRStatus(reviews []PRReview, checks []PRCheck) PRStatus + type PRUser struct + Email string + Login string + Name string + type ParentPRConflictError struct + Err error + Message string + ParentPR int + ParentState string + Reason string + func NewParentPRConflictError(message string, parentPR int, parentState, reason string, err error) *ParentPRConflictError + func (e *ParentPRConflictError) Error() string + func (e *ParentPRConflictError) Unwrap() error + type PullRequest struct + Base PRBranch + Checks []PRCheck + CreatedAt time.Time + Draft bool + HTMLURL string + Head PRBranch + NodeID string + Number int + Reviewers []PRReviewer + Reviews []PRReview + State string + Title string + UpdatedAt time.Time + User PRUser + type PullRequestListOptions struct + Direction string + Page int + PerPage int + Sort string + State string + func DefaultPullRequestListOptions() *PullRequestListOptions + type RateLimitError struct + Err error + Limit int + Message string + Remaining int + ResetAt int64 + func NewRateLimitError(message string, limit, remaining int, resetAt int64, err error) *RateLimitError + func (e *RateLimitError) Error() string + func (e *RateLimitError) IsRetryable() bool + func (e *RateLimitError) Unwrap() error + type RateLimitInfo struct + Limit int + Remaining int + Reset time.Time + func ParseRateLimitHeaders(headers http.Header) *RateLimitInfo + func (r *RateLimitInfo) IsRateLimited() bool + func (r *RateLimitInfo) String() string + func (r *RateLimitInfo) TimeUntilReset() time.Duration + type Repository struct + Name string + Owner string + func (r *Repository) String() string + type RetryFunc func() (*http.Response, error) + type RetryPolicy struct + BaseDelay time.Duration + MaxDelay time.Duration + MaxRetries int + func DefaultRetryPolicy() *RetryPolicy + type RetryableError struct + Err error + Message string + func NewRetryableError(message string, err error) *RetryableError + func (e *RetryableError) Error() string + func (e *RetryableError) IsRetryable() bool + func (e *RetryableError) Unwrap() error + type ReviewerAssignment struct + Teams []string + Users []string + func GetStackAwareReviewers(opts *StackAwareReviewerOptions) *ReviewerAssignment + func ParseReviewers(reviewers []string) *ReviewerAssignment + type StackAwareReviewerOptions struct + CurrentReviewers []string + CurrentUser string + DeduplicateStack bool + InheritParent bool + ParentPR *PullRequest + type StackedPRUpdateResult struct + Error error + NewBase string + OldBase string + RebaseDetected bool + UpdatedBase bool + type StackingError struct + BaseBranch string + Context map[string]interface{} + CurrentBranch string + Err error + Message string + Operation string + func NewStackingError(message string, currentBranch, baseBranch, operation string, err error) *StackingError + func (e *StackingError) Error() string + func (e *StackingError) Unwrap() error + func (e *StackingError) WithContext(key string, value interface{}) *StackingError + type UpdatePRRequest struct + Base string + Body string + Draft *bool + State string + Title string + type User struct + Email string + Login string + Name string + type ValidationError struct + Err error + Errors []FieldError + Message string + func NewValidationError(message string, errors []FieldError, err error) *ValidationError + func (e *ValidationError) Error() string + func (e *ValidationError) Unwrap() error