Skip to content

Commit cc7d1f2

Browse files
committed
Ensure attribute names map correctly to rule names
Signed-off-by: Timo Sand <[email protected]>
1 parent 02b402a commit cc7d1f2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

github/util_ruleset_validation.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ func validateRules(ctx context.Context, d *schema.ResourceDiff, allowedRules []g
9797
if !exists {
9898
continue
9999
}
100-
if ruleName == "required_code_scanning" {
101-
ruleName = string(github.RulesetRuleTypeCodeScanning) // This is one of the few rules which is not mapped to the same name in the API.
100+
// These are the few rules which are not mapped to the same name in the API.
101+
switch ruleName {
102+
case "required_code_scanning":
103+
ruleName = string(github.RulesetRuleTypeCodeScanning)
104+
case "required_workflows":
105+
ruleName = string(github.RulesetRuleTypeWorkflows)
102106
}
103107
switch ruleValue := ruleValue.(type) {
104108
case []any:

0 commit comments

Comments
 (0)