github

package
v0.14.8 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 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
}

func (*GitHubInfo) Key added in v0.11.0

func (i *GitHubInfo) Key() string

type GitHubInterface

type GitHubInterface interface {
	// GetInfo returns the list of pull requests from GitHub which match the local stack of commits
	GetInfo(ctx context.Context, gitcmd git.GitInterface) *GitHubInfo

	// GetAssignableUsers returns a list of valid GitHub users that can review the pull request
	GetAssignableUsers(ctx context.Context) []RepoAssignee

	// CreatePullRequest creates a pull request
	CreatePullRequest(ctx context.Context, gitcmd git.GitInterface, info *GitHubInfo, commit git.Commit, prevCommit *git.Commit) *PullRequest

	// UpdatePullRequest updates a pull request with current commit
	UpdatePullRequest(ctx context.Context, gitcmd git.GitInterface, pullRequests []*PullRequest, pr *PullRequest, commit git.Commit, prevCommit *git.Commit)

	// AddReviewers adds a reviewer to the given pull request
	AddReviewers(ctx context.Context, pr *PullRequest, userIDs []string)

	// CommentPullRequest add a comment to the given pull request
	CommentPullRequest(ctx context.Context, pr *PullRequest, comment string)

	// MergePullRequest merged the given pull request
	MergePullRequest(ctx context.Context, pr *PullRequest, mergeMethod genclient.PullRequestMergeMethod)

	// ClosePullRequest closes the given pull request
	ClosePullRequest(ctx context.Context, pr *PullRequest)
}

type PullRequest

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

	MergeStatus PullRequestMergeStatus
	Merged      bool
	Commits     []git.Commit
	InQueue     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