From 5e63691feec7aa1d7fda6627f7d3b42d385a03ab Mon Sep 17 00:00:00 2001 From: Peter Aglen <86360391+peter-aglen@users.noreply.github.com> Date: Fri, 8 Dec 2023 14:36:23 +0100 Subject: [PATCH] Fix broken CreateOrUpdateRepoCustomPropertyValues (#3023) Fixes: #3021. --- github/orgs_properties.go | 6 +++--- github/orgs_properties_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/github/orgs_properties.go b/github/orgs_properties.go index 45e3f1f964..2e88b7f4f9 100644 --- a/github/orgs_properties.go +++ b/github/orgs_properties.go @@ -178,12 +178,12 @@ func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org // GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories // //meta:operation PATCH /orgs/{org}/properties/values -func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomProperty) (*Response, error) { +func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomPropertyValue) (*Response, error) { u := fmt.Sprintf("orgs/%v/properties/values", org) params := struct { - RepositoryNames []string `json:"repository_names"` - Properties []*CustomProperty `json:"properties"` + RepositoryNames []string `json:"repository_names"` + Properties []*CustomPropertyValue `json:"properties"` }{ RepositoryNames: repoNames, Properties: properties, diff --git a/github/orgs_properties_test.go b/github/orgs_properties_test.go index 1a37230604..86daedb3a5 100644 --- a/github/orgs_properties_test.go +++ b/github/orgs_properties_test.go @@ -347,14 +347,14 @@ func TestOrganizationsService_CreateOrUpdateRepoCustomPropertyValues(t *testing. mux.HandleFunc("/orgs/o/properties/values", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") - testBody(t, r, `{"repository_names":["repo"],"properties":[{"property_name":"service","value_type":"string"}]}`+"\n") + testBody(t, r, `{"repository_names":["repo"],"properties":[{"property_name":"service","value":"string"}]}`+"\n") }) ctx := context.Background() - _, err := client.Organizations.CreateOrUpdateRepoCustomPropertyValues(ctx, "o", []string{"repo"}, []*CustomProperty{ + _, err := client.Organizations.CreateOrUpdateRepoCustomPropertyValues(ctx, "o", []string{"repo"}, []*CustomPropertyValue{ { - PropertyName: String("service"), - ValueType: "string", + PropertyName: "service", + Value: String("string"), }, }) if err != nil {