start writing up structs for rules API payloads

This commit is contained in:
vilmibm 2023-02-08 18:30:04 -08:00 committed by vaindil
parent bcb4194692
commit 79113bd304

39
pkg/cmd/ruleset/rules.go Normal file
View file

@ -0,0 +1,39 @@
package ruleset
type RuleType string
type Enforcement string
type MatchingOperator string
const (
RuleTypeCommitAuthorEmailPattern RuleType = "commit_author_email_pattern"
RuleTypePullRequest RuleType = "pull_request"
// TODO others
EnforcementEnabled Enforcement = "enabled"
EnforcementDisabled Enforcement = "disabled"
MatchingOperatorStartsWith MatchingOperator = "starts_with"
MatchingOperatorEndsWith MatchingOperator = "ends_with"
MatchingOperatorContains MatchingOperator = "contains"
MatchingOperatorRegex MatchingOperator = "regex"
)
type ConfigurationPullRequest struct {
DissmissStaleReviewsOnPush bool
RequireCodeOwnerReview bool
RequestLastPushApproval bool
RequiredApprovingReviewCount int
}
type BranchNamePattern struct {
Name string
Negate bool
Operator MatchingOperator
}
type Rule struct {
ID string
Type RuleType
Enforcement Enforcement
Configuration interface{}
}