File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 77 "net/http"
88 "strconv"
99
10- "github.com/google/go-github/v82 /github"
10+ "github.com/google/go-github/v84 /github"
1111 "github.com/hashicorp/terraform-plugin-log/tflog"
1212 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1313 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Original file line number Diff line number Diff line change @@ -322,9 +322,13 @@ func expandRepositoryPropertyConditions(v []any) *github.RepositoryRulesetReposi
322322 propertyValues = append (propertyValues , pv .(string ))
323323 }
324324 }
325+ var source * string
326+ if s := propertyMap ["source" ].(string ); s != "" {
327+ source = & s
328+ }
325329 property := & github.RepositoryRulesetRepositoryPropertyTargetParameters {
326330 Name : propertyMap ["name" ].(string ),
327- Source : new ( propertyMap [" source "].( string )) ,
331+ Source : source ,
328332 PropertyValues : propertyValues ,
329333 }
330334 include = append (include , property )
@@ -340,9 +344,13 @@ func expandRepositoryPropertyConditions(v []any) *github.RepositoryRulesetReposi
340344 propertyValues = append (propertyValues , pv .(string ))
341345 }
342346 }
347+ var source * string
348+ if s := propertyMap ["source" ].(string ); s != "" {
349+ source = & s
350+ }
343351 property := & github.RepositoryRulesetRepositoryPropertyTargetParameters {
344352 Name : propertyMap ["name" ].(string ),
345- Source : new ( propertyMap [" source "].( string )) ,
353+ Source : source ,
346354 PropertyValues : propertyValues ,
347355 }
348356 exclude = append (exclude , property )
Original file line number Diff line number Diff line change @@ -1498,7 +1498,7 @@ func TestFlattenConditionsRepositoryProperty(t *testing.T) {
14981498 },
14991499 }
15001500
1501- result := flattenConditions (context . Background (), conditions , RulesetLevelEnterprise )
1501+ result := flattenConditions (t . Context (), conditions , RulesetLevelEnterprise )
15021502
15031503 if len (result ) != 1 {
15041504 t .Fatalf ("Expected 1 element in result, got %d" , len (result ))
@@ -1568,7 +1568,7 @@ func TestRoundTripConditionsRepositoryProperty(t *testing.T) {
15681568 t .Fatal ("Expected expanded conditions to not be nil" )
15691569 }
15701570
1571- flattened := flattenConditions (context . Background (), expanded , RulesetLevelEnterprise )
1571+ flattened := flattenConditions (t . Context (), expanded , RulesetLevelEnterprise )
15721572 if len (flattened ) != 1 {
15731573 t .Fatalf ("Expected 1 flattened result, got %d" , len (flattened ))
15741574 }
You can’t perform that action at this time.
0 commit comments