integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
905 stars 745 forks source link

[FEAT]: allow creating organization_ruleset.required_status_checks only with strict_required_status_checks_policy #2111

Closed igorkliushnikov closed 9 months ago

igorkliushnikov commented 9 months ago

Describe the need

Organisational rulesets allow creating rules that enforce branches to be up to date before merging without specifying any check:

Screenshot 2024-01-19 at 14 44 04

What about making required_check optional if strict_required_status_checks_policy is set to true?

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

nickfloyd commented 9 months ago

Hey @igorkliushnikov thanks for letting us know about this need! ❤️ Let us know if you'd be interested coming up with a way to address it and then submitting a PR to be reviewed. For now I have labeled this as "Up For Grabs" so that the community knows that it's available as well.

igorkliushnikov commented 9 months ago

@nickfloyd , sorry for the delay, I've missed the notification somehow. I will be happy to experiment with the implementation next week.

igorkliushnikov commented 9 months ago

Long story short: the provider has correct validation that prevents creating a rule without concrete check, while Web UI allows to set a setting that has no effect 😄

While trying to implement the requested feature in the provider code, I was forced to reevaluate my original assumptions. I discovered that even though I can set the "required up-to-date branch" setting in the UI, in fact it will work only if it is used together with a check name. Therefore there is nothing to change in the provider code, and I'm closing the issue.