github

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 6 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
	CreatePullRequest(ctx context.Context, info *GitHubInfo, commit git.Commit, prevCommit *git.Commit) *PullRequest
	UpdatePullRequest(ctx context.Context, info *GitHubInfo, pr *PullRequest, commit git.Commit, prevCommit *git.Commit)
	CommentPullRequest(ctx context.Context, pr *PullRequest, comment string)
	MergePullRequest(ctx context.Context, pr *PullRequest)
	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 SortPullRequests

func SortPullRequests(prs []*PullRequest, config *config.Config) []*PullRequest

SortPullRequests sorts the pull requests so that the one that is on top of

master will come first followed by the ones that are stacked on top.

The stack order is maintained so that multiple pull requests can be merged in

the correct order.

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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