Documentation
¶
Index ¶
- func IsHTTPErrorCode(err error, httpCode int) bool
- func IsNotFound(err error) bool
- func ParseGHLabels(ghLabels []*gh.Label) map[string]struct{}
- type AutoMerge
- type BlockPRWith
- type Client
- func (c *Client) Assign(ctx context.Context, owner string, name string, number int, users []*gh.User) (err error)
- func (c *Client) AutoLabel(labels []string, owner string, repoName string, prNumber int) error
- func (c *Client) AutoMerge(cfg AutoMerge, owner, repoName string, base, head *gh.PullRequestBranch, ...) error
- func (c *Client) BlockPRWith(blockPRConfig BlockPRWith, owner, repoName string, prNumber int) (bool, []string, error)
- func (c *Client) CommitContains(msgsInCommit []MsgInCommit, owner, repoName string, prNumber int) error
- func (c *Client) FindPRInProject(owner, repoName string, prNumber int, project Project) (int64, int64, error)
- func (c *Client) GetColumnID(owner, repoName string, project Project) (int64, int64, error)
- func (c *Client) GetOrCreateColumnID(owner, repoName string, proj Project) (int64, error)
- func (c *Client) HandlePRE(cfg PRBlockerConfig, pre *gh.PullRequestEvent) error
- func (c *Client) HandlePRRE(cfg PRBlockerConfig, pre *gh.PullRequestReviewEvent) error
- func (c *Client) HandleSE(cfg PRBlockerConfig, se *gh.StatusEvent) error
- func (c *Client) PutPRInProject(owner, repoName string, prID int64, project Project) error
- func (c *Client) SyncPRProjects(moveToProjectsForLabelsXORed map[string]map[string]Project, ...) error
- func (c *Client) Unassign(ctx context.Context, owner string, name string, number int, users []*gh.User) (err error)
- func (c *Client) UpdateMergeabilityCheck(owner string, repoName string, prNumber int, head *gh.PullRequestBranch, ...) error
- type ErrProjectNotFound
- type MsgInCommit
- type PRBlockerConfig
- type PRLabelConfig
- type Project
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsHTTPErrorCode ¶
func IsNotFound ¶
IsNotFound returns true if the given error is a NotFound.
func ParseGHLabels ¶
ParseGHLabels parses the github labels into a map of labels (a set)
Types ¶
type BlockPRWith ¶
type BlockPRWith struct { // LabelsUnset blocks the PR if any of the Labels are not set, i.e., if any // of the regex does not match any label set in the PR. LabelsUnset []PRLabelConfig `yaml:"labels-unset,omitempty"` // LabelsSet blocks the PR if any of the Labels are set, i.e., if any of the // regex matches any label set in the PR. LabelsSet []PRLabelConfig `yaml:"labels-set,omitempty"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AutoLabel ¶
AutoLabel sets the labels automatically in a PR that is opened or reopened.
func (*Client) AutoMerge ¶ added in v1.0.0
func (c *Client) AutoMerge( cfg AutoMerge, owner, repoName string, base, head *gh.PullRequestBranch, prNumber int, review *gh.PullRequestReview, ) error
func (*Client) BlockPRWith ¶
func (c *Client) BlockPRWith(blockPRConfig BlockPRWith, owner, repoName string, prNumber int) (bool, []string, error)
BlockPRWith returns true if the PR needs to be blocked based on the logic stored under config.BlockPRWith.
func (*Client) CommitContains ¶
func (c *Client) CommitContains(msgsInCommit []MsgInCommit, owner, repoName string, prNumber int) error
CommitContains checks if all commits of the given PR Number contains the each msg provided for each MsgInCommit.
func (*Client) FindPRInProject ¶
func (c *Client) FindPRInProject(owner, repoName string, prNumber int, project Project) (int64, int64, error)
FindPRInProject finds the given PR number in the project. Returns the column and card ID for the given PR number. If not found, returns 0.
func (*Client) GetColumnID ¶
GetColumnID returns the ProjectID and ColumnID for the given Project.
func (*Client) GetOrCreateColumnID ¶
GetOrCreateColumnID returns the column ID for the given project. If the column is not found in the project then it will be automatically created.
func (*Client) HandlePRE ¶
func (c *Client) HandlePRE(cfg PRBlockerConfig, pre *gh.PullRequestEvent) error
func (*Client) HandlePRRE ¶ added in v1.0.0
func (c *Client) HandlePRRE(cfg PRBlockerConfig, pre *gh.PullRequestReviewEvent) error
func (*Client) HandleSE ¶ added in v1.0.0
func (c *Client) HandleSE(cfg PRBlockerConfig, se *gh.StatusEvent) error
func (*Client) PutPRInProject ¶
PutPRInProject puts the given prID (not PR number) into the given project.
func (*Client) SyncPRProjects ¶
func (c *Client) SyncPRProjects( moveToProjectsForLabelsXORed map[string]map[string]Project, owner, repoName string, prID int64, prNumber int, ) error
SyncPRProjects syncs the given prID (not PR Number) across all projects defined in the moveToProjectsForLabelsXORed
func (*Client) UpdateMergeabilityCheck ¶
func (c *Client) UpdateMergeabilityCheck( owner string, repoName string, prNumber int, head *gh.PullRequestBranch, blockPR bool, blockReasons []string, ) error
UpdateMergeabilityCheck sets the mergeability checker with "Success" or "Failure" in case the PR needs to be blocked from mergeability.
type ErrProjectNotFound ¶ added in v1.0.0
type ErrProjectNotFound struct {
// contains filtered or unexported fields
}
func (ErrProjectNotFound) Error ¶ added in v1.0.0
func (e ErrProjectNotFound) Error() string
func (*ErrProjectNotFound) Is ¶ added in v1.0.0
func (e *ErrProjectNotFound) Is(target error) bool
type MsgInCommit ¶
type MsgInCommit struct { // Msg is the message that should be found in the commit message. Msg string `yaml:"msg,omitempty"` // Helper is the message that should be printed if 'Msg' is not found in // the commit message. Helper string `yaml:"helper,omitempty"` // SetLabels are the labels to be set in the PR for which Msg was not found. SetLabels []string `yaml:"set-labels,omitempty"` }
type PRBlockerConfig ¶
type PRBlockerConfig struct { Project `yaml:",inline"` MoveToProjectsForLabelsXORed map[string]map[string]Project `yaml:"move-to-projects-for-labels-xored,omitempty"` RequireMsgsInCommit []MsgInCommit `yaml:"require-msgs-in-commit,omitempty"` AutoLabel []string `yaml:"auto-label,omitempty"` BlockPRWith BlockPRWith `yaml:"block-pr-with,omitempty"` AutoMerge AutoMerge `yaml:"auto-merge,omitempty"` }
type PRLabelConfig ¶
type PRLabelConfig struct { // RegexLabel contains the regex that will be used to find for labels. RegexLabel string `yaml:"regex-label,omitempty"` // Helper will print the a helper message in case the regex-label is or // isn't matched. Helper string `yaml:"helper,omitempty"` // SetLabels will set the labels in case the RegexLabel matches the labels // of a PR. SetLabels []string `yaml:"set-labels,omitempty"` }