Documentation ¶
Index ¶
- func ListOpenPullRequests(ctx context.Context, client *github.Client, owner, repoName string) ([]*github.PullRequest, error)
- func ListOpenPullRequestsForRef(ctx context.Context, client *github.Client, owner, repoName, ref string) ([]*github.PullRequest, error)
- func ListOpenPullRequestsForSHA(ctx context.Context, client *github.Client, owner, repoName, SHA string) ([]*github.PullRequest, error)
- type Commit
- type Context
- type GithubContext
- func (ghc *GithubContext) BaseOwner() string
- func (ghc *GithubContext) BaseRef() string
- func (ghc *GithubContext) BaseRepo() string
- func (ghc *GithubContext) Body() string
- func (ghc *GithubContext) Branches() (base string, head string)
- func (ghc *GithubContext) Comments(ctx context.Context) ([]string, error)
- func (ghc *GithubContext) Commits(ctx context.Context) ([]*Commit, error)
- func (ghc *GithubContext) CurrentStatuses(ctx context.Context) ([]string, map[string]string, error)
- func (ghc *GithubContext) IsDraft() bool
- func (ghc *GithubContext) IsTargeted(ctx context.Context) (bool, error)
- func (ghc *GithubContext) Labels(ctx context.Context) ([]string, error)
- func (ghc *GithubContext) Locator() string
- func (ghc *GithubContext) MergeState(ctx context.Context) (*MergeState, error)
- func (ghc *GithubContext) Number() int
- func (ghc *GithubContext) Owner() string
- func (ghc *GithubContext) PullRequestsForBranch(ctx context.Context) ([]*github.PullRequest, error)
- func (ghc *GithubContext) PushRestrictions(ctx context.Context) (bool, error)
- func (ghc *GithubContext) Repo() string
- func (ghc *GithubContext) RequiredStatuses(ctx context.Context) ([]string, error)
- func (ghc *GithubContext) Title() string
- type MergeState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListOpenPullRequests ¶
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 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 (*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 ¶
Click to show internal directories.
Click to hide internal directories.