diff --git a/github/github-accessors.go b/github/github-accessors.go index ea4cfb75da1..94c08a957bd 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -22054,6 +22054,14 @@ func (r *RulesetRepositoryNamesConditionParameters) GetProtected() bool { return *r.Protected } +// GetSource returns the Source field if it's non-nil, zero value otherwise. +func (r *RulesetRepositoryPropertyTargetParameters) GetSource() string { + if r == nil || r.Source == nil { + return "" + } + return *r.Source +} + // GetBusy returns the Busy field if it's non-nil, zero value otherwise. func (r *Runner) GetBusy() bool { if r == nil || r.Busy == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index acd3febe8f6..0cfe4c10c22 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -28247,6 +28247,17 @@ func TestRulesetRepositoryNamesConditionParameters_GetProtected(tt *testing.T) { r.GetProtected() } +func TestRulesetRepositoryPropertyTargetParameters_GetSource(tt *testing.T) { + tt.Parallel() + var zeroValue string + r := &RulesetRepositoryPropertyTargetParameters{Source: &zeroValue} + r.GetSource() + r = &RulesetRepositoryPropertyTargetParameters{} + r.GetSource() + r = nil + r.GetSource() +} + func TestRunner_GetBusy(tt *testing.T) { tt.Parallel() var zeroValue bool diff --git a/github/orgs_rules_test.go b/github/orgs_rules_test.go index ac391dae531..ca6e3f84ce4 100644 --- a/github/orgs_rules_test.go +++ b/github/orgs_rules_test.go @@ -454,7 +454,6 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. "exclude": [ { "name": "testExcludeProp", - "source": "custom", "property_values": [ "false" ] @@ -590,14 +589,13 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: "custom", + Source: String("custom"), Values: []string{"true"}, }, }, Exclude: []RulesetRepositoryPropertyTargetParameters{ { Name: "testExcludeProp", - Source: "custom", Values: []string{"false"}, }, }, @@ -692,14 +690,13 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: "custom", + Source: String("custom"), Values: []string{"true"}, }, }, Exclude: []RulesetRepositoryPropertyTargetParameters{ { Name: "testExcludeProp", - Source: "custom", Values: []string{"false"}, }, }, @@ -1287,7 +1284,7 @@ func TestOrganizationsService_GetOrganizationRulesetWithRepoPropCondition(t *tes Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: "custom", + Source: String("custom"), Values: []string{"true"}, }, }, @@ -1480,7 +1477,7 @@ func TestOrganizationsService_UpdateOrganizationRulesetWithRepoProp(t *testing.T Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: "custom", + Source: String("custom"), Values: []string{"true"}, }, }, @@ -1512,7 +1509,7 @@ func TestOrganizationsService_UpdateOrganizationRulesetWithRepoProp(t *testing.T Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: "custom", + Source: String("custom"), Values: []string{"true"}, }, }, diff --git a/github/repos_rules.go b/github/repos_rules.go index 07e8afad0ed..0d5052a4b1e 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -52,7 +52,7 @@ type RulesetRepositoryIDsConditionParameters struct { type RulesetRepositoryPropertyTargetParameters struct { Name string `json:"name"` Values []string `json:"property_values"` - Source string `json:"source"` + Source *string `json:"source,omitempty"` } // RulesetRepositoryPropertyConditionParameters represents the conditions object for repository_property.