prow/plugins/require-matching-label/require-matching-label.go
func matchingConfigs(org, repo, branch, label string, allConfigs []plugins.RequireMatchingLabel) []plugins.RequireMatchingLabel {
	var filtered []plugins.RequireMatchingLabel
	for _, cfg := range allConfigs {
		// Check if the config applies to this issue type.
		if (branch == "" && !cfg.Issues) || (branch != "" && !cfg.PRs) {
			continue
		}
		// Check if the config applies to this 'org[/repo][/branch]'.
		if org != cfg.Org ||
			(cfg.Repo != "" && cfg.Repo != repo) ||
			(cfg.Branch != "" && branch != "" && cfg.Branch != branch) {
			continue
		}
		// If we are reacting to a label event, see if it is relevant.
		if label != "" && !cfg.Re.MatchString(label) {
			continue
		}
		filtered = append(filtered, cfg)
	}
	return filtered
}
func matchingConfigs(org, repo, branch, label string, allConfigs []plugins.RequireMatchingLabel) []plugins.RequireMatchingLabel {
	var filtered []plugins.RequireMatchingLabel
	for _, cfg := range allConfigs {
		// Check if the config applies to this issue type.
		if (branch == "" && !cfg.Issues) || (branch != "" && !cfg.PRs) {
			continue
		}
		// Check if the config applies to this 'org[/repo][/branch]'.
		if org != cfg.Org ||
			(cfg.Repo != "" && cfg.Repo != repo) ||
			(cfg.Branch != "" && branch != "" && cfg.Branch != branch) {
			continue
		}
		// If we are reacting to a label event, see if it is relevant.
		if label != "" && !cfg.Re.MatchString(label) {
			continue
		}
		filtered = append(filtered, cfg)
	}
	return filtered
}
// matchingConfigs filters irrelevant RequireMtchingLabel configs from
// the list of all configs.
// `branch` should be empty for Issues and non-empty for PRs.
// `label` should be omitted in the case of 'open' and 'reopen' actions.