pull

package
v0.0.0-...-dabe4b8 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListOpenPullRequests

func ListOpenPullRequests(ctx context.Context, client *github.Client, owner, repoName string) ([]*github.PullRequest, error)

func ListOpenPullRequestsForRef

func ListOpenPullRequestsForRef(ctx context.Context, client *github.Client, owner, repoName, ref string) ([]*github.PullRequest, error)

func ListOpenPullRequestsForSHA

func ListOpenPullRequestsForSHA(ctx context.Context, client *github.Client, owner, repoName, SHA string) ([]*github.PullRequest, error)

ListOpenPullRequestsForSHA returns all pull requests where the HEAD of the source branch in the pull request matches the given SHA.

Types

type Commit

type Commit struct {
	SHA     string
	Message string
}

type Context

type Context interface {
	// Owner returns the pull request repository owner.
	Owner() string

	// Repo returns the pull request repository name.
	Repo() string

	// Number returns the pull request number.
	Number() int

	// Locator returns a locator string for the pull request. The locator
	// string is formatted as "<owner>/<repository>#<number>"
	Locator() string

	// Title returns the pull request title.
	Title() string

	// Body returns the pull request body.
	Body() string

	// Branches returns the base (also known as target) and head branch names
	// of this pull request. Branches in this repository have no prefix, while
	// branches in forks are prefixed with the owner of the fork and a colon.
	// The base branch will always be unprefixed.
	Branches() (base string, head string)

	BaseOwner() string
	BaseRepo() string
	BaseRef() string

	// MergeState returns the current mergability of the pull request. It
	// always returns the most up-to-date state possible.
	MergeState(ctx context.Context) (*MergeState, error)

	// RequiredStatuses returns the names of the required status
	// checks for the pull request.
	RequiredStatuses(ctx context.Context) ([]string, error)

	// PushRestrictions returns true if the target barnch of the pull request
	// restricts the users or teams that have push access.
	PushRestrictions(ctx context.Context) (bool, error)

	// CurrentStatuses returns the names of all successful status checks for the pull request
	// and names and descriptions of all failed status checks.
	CurrentStatuses(ctx context.Context) ([]string, map[string]string, error)

	// Comments lists all comments on the pull request.
	Comments(ctx context.Context) ([]string, error)

	// Commits lists all commits on the pull request.
	Commits(ctx context.Context) ([]*Commit, error)

	// Labels lists all labels on the pull request.
	Labels(ctx context.Context) ([]string, error)

	// PullRequestsForBranch returns the list open pull requests targeting the branch of this pull request
	PullRequestsForBranch(ctx context.Context) ([]*github.PullRequest, error)

	// IsTargeted returns true if the head branch of this pull request is the
	// target branch of other open PRs on the repository.
	IsTargeted(ctx context.Context) (bool, error)

	// IsDraft returns true if the PR is in draft state
	IsDraft() bool
}

Context is the context for a pull request. It defines methods to get information about the pull request. It is assumed that the implementation is not thread safe.

A new Context should be created each time a Pull Request is being evaluated such that implementations are not required to consider cache invalidation.

func NewGithubContext

func NewGithubContext(client *github.Client, pr *github.PullRequest) Context

type GithubContext

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

GithubContext is a Context implementation that gets information from GitHub. A new instance must be created for each request.

func (*GithubContext) BaseOwner

func (ghc *GithubContext) BaseOwner() string

func (*GithubContext) BaseRef

func (ghc *GithubContext) BaseRef() string

func (*GithubContext) BaseRepo

func (ghc *GithubContext) BaseRepo() string

func (*GithubContext) Body

func (ghc *GithubContext) Body() string

func (*GithubContext) Branches

func (ghc *GithubContext) Branches() (base string, head string)

func (*GithubContext) Comments

func (ghc *GithubContext) Comments(ctx context.Context) ([]string, error)

func (*GithubContext) Commits

func (ghc *GithubContext) Commits(ctx context.Context) ([]*Commit, error)

func (*GithubContext) CurrentStatuses

func (ghc *GithubContext) CurrentStatuses(ctx context.Context) ([]string, map[string]string, error)

func (*GithubContext) IsDraft

func (ghc *GithubContext) IsDraft() bool

func (*GithubContext) IsTargeted

func (ghc *GithubContext) IsTargeted(ctx context.Context) (bool, error)

func (*GithubContext) Labels

func (ghc *GithubContext) Labels(ctx context.Context) ([]string, error)

func (*GithubContext) Locator

func (ghc *GithubContext) Locator() string

func (*GithubContext) MergeState

func (ghc *GithubContext) MergeState(ctx context.Context) (*MergeState, error)

func (*GithubContext) Number

func (ghc *GithubContext) Number() int

func (*GithubContext) Owner

func (ghc *GithubContext) Owner() string

func (*GithubContext) PullRequestsForBranch

func (ghc *GithubContext) PullRequestsForBranch(ctx context.Context) ([]*github.PullRequest, error)

func (*GithubContext) PushRestrictions

func (ghc *GithubContext) PushRestrictions(ctx context.Context) (bool, error)

func (*GithubContext) Repo

func (ghc *GithubContext) Repo() string

func (*GithubContext) RequiredStatuses

func (ghc *GithubContext) RequiredStatuses(ctx context.Context) ([]string, error)

func (*GithubContext) Title

func (ghc *GithubContext) Title() string

type MergeState

type MergeState struct {
	Closed    bool
	Mergeable *bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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