Help us shape the future of Go! Take the 2026 Go Developer Survey

gh

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	SetWarningBuffer(writer io.Writer)
	SetInfoBuffer(writer io.Writer)
	InitPR(pr_id int) error
	PR() *github.PullRequest
	InitUserReviewerMap(reviewers []string) error
	GetTokenUser() (string, error)
	InitReviews() error
	AllApprovals() ([]*CurrentApproval, error)
	FindUserApproval(ghUser string) (*CurrentApproval, error)
	GetCurrentReviewerApprovals() ([]*CurrentApproval, error)
	GetAlreadyReviewed() ([]string, error)
	GetCurrentlyRequested() ([]string, error)
	DismissStaleReviews(staleApprovals []*CurrentApproval) error
	RequestReviewers(reviewers []string) error
	ApprovePR() error
	InitComments() error
	AddComment(comment string) error
	FindExistingComment(prefix string, since *time.Time) (int64, bool, error)
	UpdateComment(commentID int64, body string) error
	IsInComments(comment string, since *time.Time) (bool, error)
	IsSubstringInComments(substring string, since *time.Time) (bool, error)
	CheckApprovals(fileReviewerMap map[string][]string, approvals []*CurrentApproval, originalDiff git.Diff) (approvers []string, staleApprovals []*CurrentApproval)
	IsInLabels(labels []string) (bool, error)
}

func NewClient

func NewClient(owner, repo, token string) Client

type CurrentApproval

type CurrentApproval struct {
	GHLogin   string
	ReviewID  int64
	Reviewers []string
	CommitID  string
}

func (*CurrentApproval) String

func (p *CurrentApproval) String() string

type GHClient added in v0.1.3

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

func (*GHClient) AddComment added in v0.1.3

func (gh *GHClient) AddComment(comment string) error

func (*GHClient) AllApprovals added in v0.1.3

func (gh *GHClient) AllApprovals() ([]*CurrentApproval, error)

func (*GHClient) ApprovePR added in v0.1.3

func (gh *GHClient) ApprovePR() error

func (*GHClient) CheckApprovals added in v0.1.3

func (gh *GHClient) CheckApprovals(
	fileReviewerMap map[string][]string,
	approvals []*CurrentApproval,
	originalDiff git.Diff,
) (approvers []string, staleApprovals []*CurrentApproval)

Apply approver satisfaction to the owners map, and return the approvals which should be invalidated

func (*GHClient) DismissStaleReviews added in v0.1.3

func (gh *GHClient) DismissStaleReviews(staleApprovals []*CurrentApproval) error

func (*GHClient) FindExistingComment added in v0.2.0

func (gh *GHClient) FindExistingComment(prefix string, since *time.Time) (int64, bool, error)

func (*GHClient) FindUserApproval added in v0.1.3

func (gh *GHClient) FindUserApproval(ghUser string) (*CurrentApproval, error)

func (*GHClient) GetAlreadyReviewed added in v0.1.3

func (gh *GHClient) GetAlreadyReviewed() ([]string, error)

func (*GHClient) GetCurrentReviewerApprovals added in v0.1.3

func (gh *GHClient) GetCurrentReviewerApprovals() ([]*CurrentApproval, error)

func (*GHClient) GetCurrentlyRequested added in v0.1.3

func (gh *GHClient) GetCurrentlyRequested() ([]string, error)

func (*GHClient) GetTokenUser added in v0.1.3

func (gh *GHClient) GetTokenUser() (string, error)

func (*GHClient) InitComments added in v0.1.3

func (gh *GHClient) InitComments() error

func (*GHClient) InitPR added in v0.1.3

func (gh *GHClient) InitPR(pr_id int) error

func (*GHClient) InitReviews added in v0.1.3

func (gh *GHClient) InitReviews() error

func (*GHClient) InitUserReviewerMap added in v0.1.3

func (gh *GHClient) InitUserReviewerMap(reviewers []string) error

func (*GHClient) IsInComments added in v0.1.3

func (gh *GHClient) IsInComments(comment string, since *time.Time) (bool, error)

func (*GHClient) IsInLabels added in v0.1.3

func (gh *GHClient) IsInLabels(labels []string) (bool, error)

IsInLabels checks if the PR has any of the given labels

func (*GHClient) IsSubstringInComments added in v0.1.3

func (gh *GHClient) IsSubstringInComments(substring string, since *time.Time) (bool, error)

func (*GHClient) PR added in v0.1.3

func (gh *GHClient) PR() *github.PullRequest

func (*GHClient) RequestReviewers added in v0.1.3

func (gh *GHClient) RequestReviewers(reviewers []string) error

func (*GHClient) SetInfoBuffer added in v0.1.3

func (gh *GHClient) SetInfoBuffer(writer io.Writer)

func (*GHClient) SetWarningBuffer added in v0.1.3

func (gh *GHClient) SetWarningBuffer(writer io.Writer)

func (*GHClient) UpdateComment added in v0.2.0

func (gh *GHClient) UpdateComment(commentID int64, body string) error

type NoPRError

type NoPRError struct{}

func (NoPRError) Error

func (e NoPRError) Error() string

type UserReviewerMapNotInitError

type UserReviewerMapNotInitError struct{}

func (UserReviewerMapNotInitError) Error

Jump to

Keyboard shortcuts

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