mirror of
https://github.com/ossf/scorecard.git
synced 2024-09-21 05:57:42 +03:00
d03c8cbb43
* revert the change which made RequiredPullRequestReviews a pointer While the current approach works with the tiered scoring, it wont work for probes or if we remove tiers. Making the struct nil to signal that PRs aren't required hides some of the data we do have. This is especially problematic for repo rules, where we can infer all settings by what we see or dont see. Signed-off-by: Spencer Schrock <sschrock@google.com> * add helper to deref pointers Signed-off-by: Spencer Schrock <sschrock@google.com> * clarify comments and keep code consistent Signed-off-by: Spencer Schrock <sschrock@google.com> --------- Signed-off-by: Spencer Schrock <sschrock@google.com>
49 lines
1.6 KiB
Go
49 lines
1.6 KiB
Go
// Copyright 2021 OpenSSF Scorecard Authors
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package clients
|
|
|
|
// BranchRef represents a single branch reference and its protection rules.
|
|
type BranchRef struct {
|
|
Name *string
|
|
Protected *bool
|
|
BranchProtectionRule BranchProtectionRule
|
|
}
|
|
|
|
// BranchProtectionRule captures the settings enabled on a branch for security.
|
|
type BranchProtectionRule struct {
|
|
RequiredPullRequestReviews PullRequestReviewRule
|
|
AllowDeletions *bool
|
|
AllowForcePushes *bool
|
|
RequireLinearHistory *bool
|
|
EnforceAdmins *bool
|
|
RequireLastPushApproval *bool
|
|
CheckRules StatusChecksRule
|
|
}
|
|
|
|
// StatusChecksRule captures settings on status checks.
|
|
type StatusChecksRule struct {
|
|
UpToDateBeforeMerge *bool
|
|
RequiresStatusChecks *bool
|
|
Contexts []string
|
|
}
|
|
|
|
// PullRequestReviewRule captures settings on a PullRequest.
|
|
type PullRequestReviewRule struct {
|
|
Required *bool // are PRs required
|
|
RequiredApprovingReviewCount *int32
|
|
DismissStaleReviews *bool
|
|
RequireCodeOwnerReviews *bool
|
|
}
|