prow/cmd/branchprotector/request.go
func makeReviews(rp *branchprotection.ReviewPolicy) *github.RequiredPullRequestReviews {
	switch {
	case rp == nil:
		return nil
	case rp.Approvals == nil:
		logrus.Warn("WARNING: required_pull_request_reviews policy does not specify required_approving_review_count, disabling")
		return nil
	case *rp.Approvals == 0:
		return nil
	}
	rprr := github.RequiredPullRequestReviews{
		DismissStaleReviews:          makeBool(rp.DismissStale),
		RequireCodeOwnerReviews:      makeBool(rp.RequireOwners),
		RequiredApprovingReviewCount: *rp.Approvals,
	}
	if rp.DismissalRestrictions != nil {
		rprr.DismissalRestrictions = *makeRestrictions(rp.DismissalRestrictions)
	}
	return &rprr
}
func makeReviews(rp *branchprotection.ReviewPolicy) *github.RequiredPullRequestReviews {
	switch {
	case rp == nil:
		return nil
	case rp.Approvals == nil:
		logrus.Warn("WARNING: required_pull_request_reviews policy does not specify required_approving_review_count, disabling")
		return nil
	case *rp.Approvals == 0:
		return nil
	}
	rprr := github.RequiredPullRequestReviews{
		DismissStaleReviews:          makeBool(rp.DismissStale),
		RequireCodeOwnerReviews:      makeBool(rp.RequireOwners),
		RequiredApprovingReviewCount: *rp.Approvals,
	}
	if rp.DismissalRestrictions != nil {
		rprr.DismissalRestrictions = *makeRestrictions(rp.DismissalRestrictions)
	}
	return &rprr
}
func makeReviews ( rp * branchprotection . ReviewPolicy ) * github . RequiredPullRequestReviews { switch { case rp == nil : return nil case rp . Approvals == nil : logrus . Warn ( " " ) return nil case * rp . Approvals == 0 : return nil } rprr := github . RequiredPullRequestReviews { DismissStaleReviews : makeBool ( rp . DismissStale ) , RequireCodeOwnerReviews : makeBool ( rp . RequireOwners ) , RequiredApprovingReviewCount : * rp . Approvals , } if rp . DismissalRestrictions != nil { rprr . DismissalRestrictions = * makeRestrictions ( rp . DismissalRestrictions ) } return & rprr }
// makeReviews renders review policy into the corresponding GitHub api object.
//
// Returns nil if the policy is nil, or approvals is nil or 0.
makeReviews renders review policy into the corresponding GitHub api object . Returns nil if the policy is nil or approvals is nil or 0 .