Commit 94f71cf
authored
feat : Support repository property for GitHub organization ruleset (#2356)
* Define schema for repository_property
Refactor expandConditions to reduce complexity
Refactor logic to reduce the cognitive complexity and add logic to handle the repository_property field
Flatten conditions for repository_property and fix schemas
Add test case when ruleset use repository_property
Refactor repository property conditions to make them optional
Flatten update Target parameters to allow the detection of changes when remote resource is updated
Update documentation
* Apply format in the code base
* Fix repository_property validation and docs
- Add ValidateFunc to include.source field for consistency with exclude
- Update docs to mention repository_property as third targeting option
- Fix missing space in documentation
* Support repository_property in push rulesets
* Remove unused customdiff imports
* Replace custom validation with built-in ExactlyOneOf for repo targeting
Add ExactlyOneOf/AtLeastOneOf to repository_property, repository_name,repository_id fields.
Remove manual validation counting in util_ruleset_validation.Add 3 validation tests for single/multiple/missing repo targeting options.
Addresses PR #2356 review feedback - simplifies validation using schema constraints.
* Rever unintencial change
* Add tests, docs, and fix default handling for repository_property
- Add doc example for repository_property usage
- Add tests for exclude block, multiple properties, and updates
- Fix source field default handling in flatten function to prevent diffs
* Apply suggestions from PR comment
* Add unit tests
* Remove redundant condition
* Updated description based in the GitHub API docs
* Apply linter and fmt
* Remove unnecessary checks
* Remove tests
These tests check validation that was handover to the Terraform built-in validation
* Improve syntax for include and exclude property
Improve e2e tests for the ruleset and improve documentation
* Use t context
* Rewrite tests using the resource_github_organization_custom_properties
Setup the tests case using the config instead of using the API
* Refactor repository property names in organization ruleset tests for consistency
* Refactor tests to use state checks for repository property validation in organization ruleset
* Update repository property references to use default_branch in organization ruleset tests
* Fix: Replace ExactlyOneOf with ConflictsWith/AtLeastOneOf for repository conditions
ExactlyOneOf has known issues with nested optional list blocks in Terraform SDK.
Use ConflictsWith + AtLeastOneOf pattern for reliable "exactly one" validation
across repository_name, repository_id, and repository_property conditions.
Updated test expectations to match new error message format from ConflictsWith.
Addresses feedback from PR #2356 comment r2968116244, references fix from #3235
* Apply lint1 parent 636eff4 commit 94f71cf
File tree
7 files changed
+1140
-54
lines changed- github
- website/docs/r
7 files changed
+1140
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
126 | 198 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
133 | 205 | | |
134 | 206 | | |
135 | 207 | | |
| |||
158 | 230 | | |
159 | 231 | | |
160 | 232 | | |
161 | | - | |
162 | | - | |
163 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
164 | 238 | | |
165 | 239 | | |
166 | 240 | | |
| |||
0 commit comments