Skip to content

Commit f23df92

Browse files
committed
fix: update go-github dependency to v84 and improve source handling in repository property conditions
1 parent 838432b commit f23df92

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

github/resource_github_enterprise_ruleset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
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"

github/util_rules.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff 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)

github/util_rules_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)