Documentation ¶
Index ¶
- Constants
- func FormatICResponse(ic github.IssueComment, s string) string
- func FormatResponse(to, message, reason string) string
- func FormatResponseRaw(body, bodyURL, login, reply string) string
- func FormatSimpleResponse(to, message string) string
- func FormatTestLabels(org, repo string, number int, labels ...string) []string
- type AutoRespond
- type BlockLabel
- type ConfigAgent
- type Configuration
- func (c *Configuration) AutoresponderFor(org, repo string) *TiCommunityAutoresponder
- func (c *Configuration) BlunderbussFor(org, repo string) *TiCommunityBlunderbuss
- func (c *Configuration) CherrypickerFor(org, repo string) *TiCommunityCherrypicker
- func (c *Configuration) ContributionFor(org, repo string) *TiCommunityContribution
- func (c *Configuration) LabelBlockerFor(org, repo string) *TiCommunityLabelBlocker
- func (c *Configuration) LabelFor(org, repo string) *TiCommunityLabel
- func (c *Configuration) LgtmFor(org, repo string) *TiCommunityLgtm
- func (c *Configuration) MergeFor(org, repo string) *TiCommunityMerge
- func (c *Configuration) OwnersFor(org, repo string) *TiCommunityOwners
- func (c *Configuration) TarsFor(org, repo string) *TiCommunityTars
- func (c *Configuration) Validate() error
- type EventType
- type TiCommunityAutoresponder
- type TiCommunityBlunderbuss
- type TiCommunityCherrypicker
- type TiCommunityContribution
- type TiCommunityLabel
- type TiCommunityLabelBlocker
- type TiCommunityLgtm
- type TiCommunityMerge
- type TiCommunityOwnerBranchConfig
- type TiCommunityOwners
- type TiCommunityTars
Constants ¶
const ( LabeledAction = "labeled" UnlabeledAction = "unlabeled" )
Allowed value of the action configuration of the label blocker plugin.
const ( // LgtmLabelPrefix is the name of the lgtm label applied by the lgtm plugin. LgtmLabelPrefix = "status/LGT" // SigPrefix is a default sig label prefix. SigPrefix = "sig/" )
const ( // ContributionLabel is the name of the contribution label applied by the contribution plugin. ContributionLabel = "contribution" // FirstTimeContributorLabel is the name of the first-time-contributor label applied by the contribution plugin. FirstTimeContributorLabel = "first-time-contributor" )
const AboutThisBot = AboutThisBotWithoutCommands + " " + AboutThisBotCommands
AboutThisBot contains the text of both AboutThisBotWithoutCommands and AboutThisBotCommands.
const AboutThisBotCommands = "I understand the commands that are listed [here](https://prow.tidb.io/command-help)."
AboutThisBotCommands contains the message that links to the commands the bot understand.
const AboutThisBotWithoutCommands = "Instructions for interacting with me using PR comments are available " +
"[here](https://prow.tidb.io/command-help). " +
"If you have questions or suggestions related to my behavior, " +
"please file an issue against the " +
"[ti-community-infra/tichi]" +
"(https://github.com/ti-community-infra/tichi/issues/new?title=Prow%20issue:) repository."
AboutThisBotWithoutCommands contains the message that explains how to interact with the bot.
const (
// CanMergeLabel is the name of the merge label applied by the merge plugin.
CanMergeLabel = "status/can-merge"
)
const (
// DefaultCherryPickLabelPrefix defines the default label prefix for cherrypicker plugin.
DefaultCherryPickLabelPrefix = "cherrypick/"
)
Variables ¶
This section is empty.
Functions ¶
func FormatICResponse ¶
func FormatICResponse(ic github.IssueComment, s string) string
FormatICResponse nicely formats a response to an issue comment.
func FormatResponse ¶
FormatResponse nicely formats a response to a generic reason.
func FormatResponseRaw ¶
FormatResponseRaw nicely formats a response for one does not have an issue comment
func FormatSimpleResponse ¶
FormatSimpleResponse formats a response that does not warrant additional explanation in the details section.
Types ¶
type AutoRespond ¶
type AutoRespond struct { // Regex specifies the conditions for the trigger to respond automatically. Regex string `json:"regex,omitempty"` // Message specifies the content of the automatic respond. Message string `json:"message,omitempty"` }
AutoRespond is the config for auto respond.
type BlockLabel ¶ added in v1.1.0
type BlockLabel struct { // Regex specifies the regular expression for match the labels that need to be intercepted. Regex string `json:"regex,omitempty"` // Actions specifies the label actions that will trigger interception, you can fill in `labeled` or `unlabelled`. Actions []string `json:"actions,omitempty"` // TrustedTeams specifies the teams allowed adding/removing label. TrustedTeams []string `json:"trusted_teams,omitempty"` // TrustedUsers specifies the github login of the account allowed adding/removing label. TrustedUsers []string `json:"trusted_users,omitempty"` // Message specifies the message feedback to the user after blocking the label. Message string `json:"message,omitempty"` }
BlockLabel is the config for label blocking.
type ConfigAgent ¶
type ConfigAgent struct {
// contains filtered or unexported fields
}
ConfigAgent contains the agent mutex and the agent configuration.
func (*ConfigAgent) Config ¶
func (pa *ConfigAgent) Config() *Configuration
Config returns the agent current Configuration.
func (*ConfigAgent) Load ¶
func (pa *ConfigAgent) Load(path string) error
Load attempts to load config from the path. It returns an error if either the file can't be read or the configuration is invalid. If checkUnknownPlugins is true, unrecognized plugin names will make config loading fail.
func (*ConfigAgent) Set ¶
func (pa *ConfigAgent) Set(pc *Configuration)
Set attempts to set the plugins config.
func (*ConfigAgent) Start ¶
func (pa *ConfigAgent) Start(path string, checkUnknownPlugins bool) error
Start starts polling path for plugin config. If the first attempt fails, then start returns the error. Future errors will halt updates but not stop. If checkUnknownPlugins is true, unrecognized plugin names will make config loading fail.
type Configuration ¶
type Configuration struct { TichiWebURL string `json:"tichi_web_url,omitempty"` PRProcessLink string `json:"pr_process_link,omitempty"` CommandHelpLink string `json:"command_help_link,omitempty"` // LogLevel enables dynamically updating the log level of the // standard logger that is used by all ti community plugin. // // Valid values: // // "trace" "debug", "info", "warn", "warning", "error", "fatal", "panic" // // Defaults to "info". LogLevel string `json:"log_level,omitempty"` TiCommunityLgtm []TiCommunityLgtm `json:"ti-community-lgtm,omitempty"` TiCommunityMerge []TiCommunityMerge `json:"ti-community-merge,omitempty"` TiCommunityOwners []TiCommunityOwners `json:"ti-community-owners,omitempty"` TiCommunityLabel []TiCommunityLabel `json:"ti-community-label,omitempty"` TiCommunityAutoresponder []TiCommunityAutoresponder `json:"ti-community-autoresponder,omitempty"` TiCommunityBlunderbuss []TiCommunityBlunderbuss `json:"ti-community-blunderbuss,omitempty"` TiCommunityTars []TiCommunityTars `json:"ti-community-tars,omitempty"` TiCommunityLabelBlocker []TiCommunityLabelBlocker `json:"ti-community-label-blocker,omitempty"` TiCommunityContribution []TiCommunityContribution `json:"ti-community-contribution,omitempty"` TiCommunityCherrypicker []TiCommunityCherrypicker `json:"ti-community-cherrypicker,omitempty"` }
Configuration is the top-level serialization target for external plugin Configuration.
func (*Configuration) AutoresponderFor ¶
func (c *Configuration) AutoresponderFor(org, repo string) *TiCommunityAutoresponder
AutoresponderFor finds the TiCommunityAutoresponder for a repo, if one exists. TiCommunityAutoresponder configuration can be listed for a repository or an organization.
func (*Configuration) BlunderbussFor ¶
func (c *Configuration) BlunderbussFor(org, repo string) *TiCommunityBlunderbuss
BlunderbussFor finds the TiCommunityBlunderbuss for a repo, if one exists. TiCommunityBlunderbuss configuration can be listed for a repository or an organization.
func (*Configuration) CherrypickerFor ¶ added in v1.5.0
func (c *Configuration) CherrypickerFor(org, repo string) *TiCommunityCherrypicker
CherrypickerFor finds the TiCommunityCherrypicker for a repo, if one exists. TiCommunityCherrypicker configuration can be listed for a repository or an organization.
func (*Configuration) ContributionFor ¶ added in v1.4.0
func (c *Configuration) ContributionFor(org, repo string) *TiCommunityContribution
ContributionFor finds the TiCommunityContribution for a repo, if one exists. TiCommunityContribution configuration can be listed for a repository or an organization.
func (*Configuration) LabelBlockerFor ¶ added in v1.1.0
func (c *Configuration) LabelBlockerFor(org, repo string) *TiCommunityLabelBlocker
LabelBlockerFor finds the TiCommunityLabelBlocker for a repo, if one exists. TiCommunityLabelBlocker configuration can be listed for a repository or an organization.
func (*Configuration) LabelFor ¶
func (c *Configuration) LabelFor(org, repo string) *TiCommunityLabel
LabelFor finds the TiCommunityLabel for a repo, if one exists. TiCommunityLabel configuration can be listed for a repository or an organization.
func (*Configuration) LgtmFor ¶
func (c *Configuration) LgtmFor(org, repo string) *TiCommunityLgtm
LgtmFor finds the Lgtm for a repo, if one exists a trigger can be listed for the repo itself or for the owning organization
func (*Configuration) MergeFor ¶
func (c *Configuration) MergeFor(org, repo string) *TiCommunityMerge
MergeFor finds the TiCommunityMerge for a repo, if one exists. TiCommunityMerge configuration can be listed for a repository or an organization.
func (*Configuration) OwnersFor ¶
func (c *Configuration) OwnersFor(org, repo string) *TiCommunityOwners
OwnersFor finds the TiCommunityOwners for a repo, if one exists. TiCommunityOwners configuration can be listed for a repository or an organization.
func (*Configuration) TarsFor ¶
func (c *Configuration) TarsFor(org, repo string) *TiCommunityTars
TarsFor finds the TiCommunityTars for a repo, if one exists. TiCommunityTars configuration can be listed for a repository or an organization.
func (*Configuration) Validate ¶
func (c *Configuration) Validate() error
Validate will return an error if there are any invalid external plugin config.
type EventType ¶ added in v1.3.4
type EventType = string
EventType is an alias of string which describe the GitHub webhook event.
const ( IssuesEvent EventType = "issues" IssueCommentEvent EventType = "issue_comment" PullRequestEvent EventType = "pull_request" PullRequestReviewEvent EventType = "pull_request_review" PullRequestReviewCommentEvent EventType = "pull_request_review_comment" PushEvent EventType = "push" StatusEvent EventType = "status" )
Event type constants.
type TiCommunityAutoresponder ¶
type TiCommunityAutoresponder struct { // Repos is either of the form org/repos or just org. Repos []string `json:"repos,omitempty"` // AutoResponds is a set of responds. AutoResponds []AutoRespond `json:"auto_responds,omitempty"` }
TiCommunityAutoresponder is the config for the blunderbuss plugin.
type TiCommunityBlunderbuss ¶
type TiCommunityBlunderbuss struct { // Repos is either of the form org/repos or just org. Repos []string `json:"repos,omitempty"` // MaxReviewerCount is the maximum number of reviewers to request // reviews from. Defaults to 0 meaning no limit. MaxReviewerCount int `json:"max_request_count,omitempty"` // ExcludeReviewers specifies which reviewers do not participate in code review. ExcludeReviewers []string `json:"exclude_reviewers,omitempty"` // PullOwnersEndpoint specifies the URL of the reviewer of pull request. PullOwnersEndpoint string `json:"pull_owners_endpoint,omitempty"` // GracePeriodDuration specifies the waiting time before the plugin requests a review, // defaults to 5 means that the plugin will wait 5 seconds for the sig label to be added. GracePeriodDuration int `json:"grace_period_duration,omitempty"` // RequireSigLabel specifies whether the PR is required to have a sig label before requesting reviewers. RequireSigLabel bool `json:"require_sig_label,omitempty"` }
TiCommunityBlunderbuss is the config for the blunderbuss plugin.
type TiCommunityCherrypicker ¶ added in v1.5.0
type TiCommunityCherrypicker struct { // Repos is either of the form org/repo or just org. Repos []string `json:"repos,omitempty"` // AllowAll specifies whether everyone is allowed to cherry pick. AllowAll bool `json:"allow_all,omitempty"` // IssueOnConflict specifies whether to create an Issue when there is a PR conflict. IssueOnConflict bool `json:"create_issue_on_conflict,omitempty"` // LabelPrefix specifies the label prefix for cherrypicker. LabelPrefix string `json:"label_prefix,omitempty"` // PickedLabelPrefix specifies the label prefix after picked. PickedLabelPrefix string `json:"picked_label_prefix,omitempty"` // ExcludeLabels specifies the labels that need to be excluded when copying the labels of the original PR. ExcludeLabels []string `json:"excludeLabels,omitempty"` }
TiCommunityCherrypicker is the config for the cherrypicker plugin.
type TiCommunityContribution ¶ added in v1.4.0
type TiCommunityContribution struct { // Repos is either of the form org/repo or just org. Repos []string `json:"repos,omitempty"` // Message specifies the tips for the contributor's PR. Message string `json:"message,omitempty"` }
TiCommunityContribution is the config for the contribution plugin.
type TiCommunityLabel ¶
type TiCommunityLabel struct { // Repos is either of the form org/repos or just org. // The AdditionalLabels and Prefixes values are applicable // to these repos. Repos []string `json:"repos,omitempty"` // AdditionalLabels is a set of additional labels enabled for use // on top of the existing "status/*", "priority/*" // and "sig/*" labels. // Labels can be used with `/[remove-]label <additionalLabel>` commands. AdditionalLabels []string `json:"additional_labels,omitempty"` // Prefixes is a set of label prefixes which replaces the existing // "status", "priority"," and "sig" label prefixes. // Labels can be used with `/[remove-]<prefix> <target>` commands. Prefixes []string `json:"prefixes,omitempty"` // ExcludeLabels specifies labels that cannot be added by TiCommunityLabel. ExcludeLabels []string `json:"exclude_labels,omitempty"` }
TiCommunityLabel is the config for the label plugin.
type TiCommunityLabelBlocker ¶ added in v1.1.0
type TiCommunityLabelBlocker struct { // Repos is either of the form org/repos or just org. Repos []string `json:"repos,omitempty"` // BlockLabels is a set of label block rules. BlockLabels []BlockLabel `json:"block_labels,omitempty"` }
TiCommunityLabelBlocker is the config for the label blocker plugin.
type TiCommunityLgtm ¶
type TiCommunityLgtm struct { // Repos is either of the form org/repos or just org. Repos []string `json:"repos,omitempty"` // ReviewActsAsLgtm indicates that a GitHub review of "merge" or "request changes" // acts as adding or removing the lgtm label. ReviewActsAsLgtm bool `json:"review_acts_as_lgtm,omitempty"` // PullOwnersEndpoint specifies the URL of the reviewer of pull request. PullOwnersEndpoint string `json:"pull_owners_endpoint,omitempty"` }
TiCommunityLgtm specifies a configuration for a single ti community lgtm. The configuration for the ti community lgtm plugin is defined as a list of these structures.
type TiCommunityMerge ¶
type TiCommunityMerge struct { // Repos is either of the form org/repos or just org. Repos []string `json:"repos,omitempty"` // StoreTreeHash indicates if tree_hash should be stored inside a comment to detect // guaranteed commits before removing can merge labels. StoreTreeHash bool `json:"store_tree_hash,omitempty"` // PullOwnersEndpoint specifies the URL of the reviewer of pull request. PullOwnersEndpoint string `json:"pull_owners_endpoint,omitempty"` }
TiCommunityMerge specifies a configuration for a single merge.
The configuration for the merge plugin is defined as a list of these structures.
type TiCommunityOwnerBranchConfig ¶
type TiCommunityOwnerBranchConfig struct { // DefaultRequireLgtm specifies the default require lgtm number of the branch. DefaultRequireLgtm int `json:"default_require_lgtm,omitempty"` // TrustTeams specifies the GitHub teams whose members are trusted by the branch. TrustTeams []string `json:"trusted_teams,omitempty"` // UseGitHubPermission specifies the permissions to use GitHub. // People with write and admin permissions have reviewer and committer permissions. UseGitHubPermission bool `json:"use_github_permission,omitempty"` }
TiCommunityOwnerBranchConfig is the branch level configuration of the owners plugin.
type TiCommunityOwners ¶
type TiCommunityOwners struct { // Repos is either of the form org/repos or just org. Repos []string `json:"repos,omitempty"` // SigEndpoint specifies the URL of the sig info. SigEndpoint string `json:"sig_endpoint,omitempty"` // DefaultSigName specifies the default sig name of this repo's PR. DefaultSigName string `json:"default_sig_name,omitempty"` // DefaultRequireLgtm specifies the default require lgtm number. DefaultRequireLgtm int `json:"default_require_lgtm,omitempty"` // RequireLgtmLabelPrefix specifies the prefix of require lgtm label. RequireLgtmLabelPrefix string `json:"require_lgtm_label_prefix,omitempty"` // WARNING: This disables the security mechanism that prevents a malicious member (or // compromised GitHub account) from merging arbitrary code. Use with caution. // // TrustTeams specifies the GitHub teams whose members are trusted. TrustTeams []string `json:"trusted_teams,omitempty"` // UseGitHubPermission specifies the permissions to use GitHub. // People with write and admin permissions have reviewer and committer permissions. UseGitHubPermission bool `json:"use_github_permission,omitempty"` // Branches specifies the branch level configuration that will override the repository // level configuration. Branches map[string]TiCommunityOwnerBranchConfig `json:"branches,omitempty"` }
TiCommunityOwners specifies a configuration for a single ti community owners plugin.
The configuration for the owners plugin is defined as a list of these structures.
type TiCommunityTars ¶
type TiCommunityTars struct { // Repos is either of the form org/repos or just org. Repos []string `json:"repos,omitempty"` // Message specifies the message when the PR is automatically updated. Message string `json:"message,omitempty"` // OnlyWhenLabel specifies that the automatic update is triggered only when the PR has this label. OnlyWhenLabel string `json:"only_when_label,omitempty"` }
TiCommunityTars is the config for the tars plugin.