github

package
v0.17.5 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckStatus added in v0.17.5

type CheckStatus int

CheckStatus represents the aggregate status of GitHub checks on a pull request

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
)

func (CheckStatus) String added in v0.17.5

func (cs CheckStatus) String(config *config.Config) string

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, info *GitHubInfo, 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
	LocalCommitHash string
}

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

func (*PullRequest) TextString added in v0.17.5

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

TextString returns a plain text representation of the pull request: "<url> : <title>"

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
}

Jump to

Keyboard shortcuts

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