prow/config/branch_protection.go
func (c *Config) GetBranchProtection(org, repo, branch string) (*Policy, error) {
	if _, present := c.BranchProtection.Orgs[org]; !present {
		return nil, nil // only consider branches in configured orgs
	}
	b, err := c.BranchProtection.GetOrg(org).GetRepo(repo).GetBranch(branch)
	if err != nil {
		return nil, err
	}

	return c.GetPolicy(org, repo, branch, *b)
}
func (c *Config) GetBranchProtection(org, repo, branch string) (*Policy, error) {
	if _, present := c.BranchProtection.Orgs[org]; !present {
		return nil, nil // only consider branches in configured orgs
	}
	b, err := c.BranchProtection.GetOrg(org).GetRepo(repo).GetBranch(branch)
	if err != nil {
		return nil, err
	}

	return c.GetPolicy(org, repo, branch, *b)
}
func ( c * Config ) GetBranchProtection ( org , repo , branch string ) ( * Policy , error ) { if _ , present := c . BranchProtection . Orgs [ org ] ; ! present { return nil , nil // only consider branches in configured orgs } b , err := c . BranchProtection . GetOrg ( org ) . GetRepo ( repo ) . GetBranch ( branch ) if err != nil { return nil , err } return c . GetPolicy ( org , repo , branch , * b ) }
// GetBranchProtection returns the policy for a given branch.
//
// Handles merging any policies defined at repo/org/global levels into the branch policy.
GetBranchProtection returns the policy for a given branch . Handles merging any policies defined at repo / org / global levels into the branch policy .