prow/plugins/trigger/generic-comment.go
func FilterPresubmits(honorOkToTest bool, gitHubClient GitHubClient, body string, pr *github.PullRequest, presubmits []config.Presubmit, logger *logrus.Entry) ([]config.Presubmit, []config.Presubmit, error) {
	org, repo, sha := pr.Base.Repo.Owner.Login, pr.Base.Repo.Name, pr.Head.SHA
	filter, err := presubmitFilter(honorOkToTest, gitHubClient, body, org, repo, sha, logger)
	if err != nil {
		return nil, nil, err
	}

	number, branch := pr.Number, pr.Base.Ref
	changes := config.NewGitHubDeferredChangedFilesProvider(gitHubClient, org, repo, number)
	toTrigger, toSkipSuperset, err := pjutil.FilterPresubmits(filter, changes, branch, presubmits, logger)
	if err != nil {
		return nil, nil, err
	}
	toSkip := determineSkippedPresubmits(toTrigger, toSkipSuperset, logger)
	return toTrigger, toSkip, err
}
func FilterPresubmits(honorOkToTest bool, gitHubClient GitHubClient, body string, pr *github.PullRequest, presubmits []config.Presubmit, logger *logrus.Entry) ([]config.Presubmit, []config.Presubmit, error) {
	org, repo, sha := pr.Base.Repo.Owner.Login, pr.Base.Repo.Name, pr.Head.SHA
	filter, err := presubmitFilter(honorOkToTest, gitHubClient, body, org, repo, sha, logger)
	if err != nil {
		return nil, nil, err
	}

	number, branch := pr.Number, pr.Base.Ref
	changes := config.NewGitHubDeferredChangedFilesProvider(gitHubClient, org, repo, number)
	toTrigger, toSkipSuperset, err := pjutil.FilterPresubmits(filter, changes, branch, presubmits, logger)
	if err != nil {
		return nil, nil, err
	}
	toSkip := determineSkippedPresubmits(toTrigger, toSkipSuperset, logger)
	return toTrigger, toSkip, err
}
func FilterPresubmits ( honorOkToTest bool , gitHubClient GitHubClient , body string , pr * github . PullRequest , presubmits [ ] config . Presubmit , logger * logrus . Entry ) ( [ ] config . Presubmit , [ ] config . Presubmit , error ) { org , repo , sha := pr . Base . Repo . Owner . Login , pr . Base . Repo . Name , pr . Head . SHA filter , err := presubmitFilter ( honorOkToTest , gitHubClient , body , org , repo , sha , logger ) if err != nil { return nil , nil , err } number , branch := pr . Number , pr . Base . Ref changes := config . NewGitHubDeferredChangedFilesProvider ( gitHubClient , org , repo , number ) toTrigger , toSkipSuperset , err := pjutil . FilterPresubmits ( filter , changes , branch , presubmits , logger ) if err != nil { return nil , nil , err } toSkip := determineSkippedPresubmits ( toTrigger , toSkipSuperset , logger ) return toTrigger , toSkip , err }
// FilterPresubmits determines which presubmits should run. We only want to
// trigger jobs that should run, but the pool of jobs we filter to those that
// should run depends on the type of trigger we just got:
//  - if we get a /test foo, we only want to consider those jobs that match;
//    jobs will default to run unless we can determine they shouldn't
//  - if we got a /retest, we only want to consider those jobs that have
//    already run and posted failing contexts to the PR or those jobs that
//    have not yet run but would otherwise match /test all; jobs will default
//    to run unless we can determine they shouldn't
//  - if we got a /test all or an /ok-to-test, we want to consider any job
//    that doesn't explicitly require a human trigger comment; jobs will
//    default to not run unless we can determine that they should
// If a comment that we get matches more than one of the above patterns, we
// consider the set of matching presubmits the union of the results from the
// matching cases.
FilterPresubmits determines which presubmits should run . We only want to trigger jobs that should run but the pool of jobs we filter to those that should run depends on the type of trigger we just got : - if we get a / test foo we only want to consider those jobs that match ; jobs will default to run unless we can determine they shouldn t - if we got a / retest we only want to consider those jobs that have already run and posted failing contexts to the PR or those jobs that have not yet run but would otherwise match / test all ; jobs will default to run unless we can determine they shouldn t - if we got a / test all or an / ok - to - test we want to consider any job that doesn t explicitly require a human trigger comment ; jobs will default to not run unless we can determine that they should If a comment that we get matches more than one of the above patterns we consider the set of matching presubmits the union of the results from the matching cases .