github

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CheckStatusUnknown
	CheckStatusUnknown checkStatus = iota

	// CheckStatusPending when checks are still running
	CheckStatusPending

	// CheckStatusPass when all checks pass
	CheckStatusPass

	// CheckStatusFail when some chechs have failed
	CheckStatusFail
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubInfo

type GitHubInfo struct {
	UserName     string
	RepositoryID string
	LocalBranch  string
	PullRequests []*PullRequest
}

type GitHubInterface

type GitHubInterface interface {
	GetInfo(ctx context.Context, gitcmd git.GitInterface) *GitHubInfo
	GetAssignableUsers(ctx context.Context) []RepoAssignee
	CreatePullRequest(ctx context.Context, gitcmd git.GitInterface, info *GitHubInfo, commit git.Commit, prevCommit *git.Commit) *PullRequest
	UpdatePullRequest(ctx context.Context, gitcmd git.GitInterface, info *GitHubInfo, pr *PullRequest, commit git.Commit, prevCommit *git.Commit)
	AddReviewers(ctx context.Context, pr *PullRequest, userIDs []string)
	CommentPullRequest(ctx context.Context, pr *PullRequest, comment string)
	MergePullRequest(ctx context.Context, pr *PullRequest, mergeMethod genclient.PullRequestMergeMethod)
	ClosePullRequest(ctx context.Context, pr *PullRequest)
}

type PullRequest

type PullRequest struct {
	ID         string
	Number     int
	FromBranch string
	ToBranch   string
	Commit     git.Commit
	Title      string

	MergeStatus PullRequestMergeStatus
	Merged      bool
}

PullRequest has GitHub pull request data

func (*PullRequest) Mergeable

func (pr *PullRequest) Mergeable(config *config.Config) bool

Mergeable returns true if the pull request is mergable

func (*PullRequest) Ready

func (pr *PullRequest) Ready(config *config.Config) bool

Ready returns true if pull request is ready to merge

func (*PullRequest) StatusString

func (pr *PullRequest) StatusString(config *config.Config) string

StatusString returs a string representation of the merge status bits

func (*PullRequest) String

func (pr *PullRequest) String(config *config.Config) string

type PullRequestMergeStatus

type PullRequestMergeStatus struct {
	// ChecksPass is the status of GitHub checks
	ChecksPass checkStatus

	// ReviewApproved is true when a pull request is approved by a fellow reviewer
	ReviewApproved bool

	// NoConflicts is true when there are no merge conflicts
	NoConflicts bool

	// Stacked is true when all requests in the stack up to this one are ready to merge
	Stacked bool
}

PullRequestMergeStatus is the merge status of a pull request

type RepoAssignee added in v0.8.2

type RepoAssignee struct {
	ID    string
	Login string
	Name  string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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