-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix required workflows for organization rulesets #2253
base: main
Are you sure you want to change the base?
Conversation
|
||
case "workflows": | ||
var params github.RequiredWorkflowsRuleParameters | ||
log.Printf("[DEBUG] osama test: %v", v.Parameters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this before we merge?
@@ -472,6 +472,29 @@ func flattenRules(rules []*github.RepositoryRule, org bool) []interface{} { | |||
rule["required_check"] = requiredStatusChecksSlice | |||
rule["strict_required_status_checks_policy"] = params.StrictRequiredStatusChecksPolicy | |||
rulesMap[v.Type] = []map[string]interface{}{rule} | |||
|
|||
case "workflows": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How might this behavior be unit tested?
I do the same in my PR and also fix required_code_scanning |
|
||
rule := make(map[string]interface{}) | ||
rule["required_workflow"] = requiredWorkflowsSlice | ||
rulesMap[v.Type] = []map[string]interface{}{rule} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rulesMap[v.Type] = []map[string]interface{}{rule} | |
rulesMap["required_workflows"] = []map[string]interface{}{rule} |
you cannot use "v.Type" because it is named required_workflows in the scheme, not workflows. Look in my PR, I also add "do_not_enforce_on_create" to the scheme
Resolves #2113
Before the change?
"required_workflows": []
in state. This happens because there was no code that flattens this specific rule.After the change?
Pull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!