Documentation
¶
Index ¶
- Constants
- func ForEachCandidatePRDo(client *github.Client, user, project string, fn PRFunction, once bool, ...) error
- func GetAllEventsForPR(client *github.Client, user, project string, prNumber int) ([]github.IssueEvent, error)
- func GetStatus(client *github.Client, user, project string, prNumber int, ...) (string, error)
- func HasLabel(labels []github.Label, name string) bool
- func HasLabels(labels []github.Label, names []string) bool
- func MakeClient(token string) *github.Client
- func UsersWithCommit(client *github.Client, org, project string) ([]string, error)
- func ValidateStatus(client *github.Client, user, project string, prNumber int, ...) (bool, error)
- func WaitForPending(client *github.Client, user, project string, prNumber int) error
- type FilterConfig
- type PRFunction
- type RateLimitRoundTripper
Constants ¶
View Source
const (
NeedsOKToMergeLabel = "needs-ok-to-merge"
)
Variables ¶
This section is empty.
Functions ¶
func ForEachCandidatePRDo ¶
func ForEachCandidatePRDo(client *github.Client, user, project string, fn PRFunction, once bool, config *FilterConfig) error
For each PR in the project that matches:
- pr.Number > minPRNumber
- is mergeable
- has labels "cla: yes", "lgtm"
- combinedStatus = 'success' (e.g. all hooks have finished success in github)
Run the specified function
func GetAllEventsForPR ¶
func GetStatus ¶
func GetStatus(client *github.Client, user, project string, prNumber int, requiredContexts []string) (string, error)
Gets the current status of a PR by introspecting the status of the commits in the PR. The rules are:
- If any member of the 'requiredContexts' list is missing, it is 'incomplete'
- If any commit is 'pending', the PR is 'pending'
- If any commit is 'error', the PR is in 'error'
- If any commit is 'failure', the PR is 'failure'
- Otherwise the PR is 'success'
func MakeClient ¶
func UsersWithCommit ¶
func ValidateStatus ¶
func ValidateStatus(client *github.Client, user, project string, prNumber int, requiredContexts []string, waitOnPending bool) (bool, error)
Make sure that the combined status for all commits in a PR is 'success' if 'waitForPending' is true, this function will wait until the PR is no longer pending (all checks have run)
Types ¶
type FilterConfig ¶
type FilterConfig struct { MinPRNumber int // non-committer users believed safe AdditionalUserWhitelist []string // Committers are static here in case they can't be gotten dynamically; // they do not need to be whitelisted. Committers []string // The label needed to override absence from whitelist. WhitelistOverride string // If true, don't make any mutating API calls DryRun bool DontRequireE2ELabel string E2EStatusContext string RequiredStatusContexts []string // contains filtered or unexported fields }
func (*FilterConfig) RefreshWhitelist ¶
func (config *FilterConfig) RefreshWhitelist(client *github.Client, user, project string) util.StringSet
RefreshWhitelist updates the whitelist, re-getting the list of committers.
type PRFunction ¶
type RateLimitRoundTripper ¶
type RateLimitRoundTripper struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.