From fc383349e4d5933442c2c0320458068aecf17ef4 Mon Sep 17 00:00:00 2001 From: joshuahancox <67631498+joshuahancox@users.noreply.github.com> Date: Mon, 23 May 2022 12:02:22 +0100 Subject: [PATCH 1/2] fix: correct endpoint for custom roles --- github/{org_custom_roles.go => orgs_custom_roles.go} | 3 ++- github/{org_custom_roles_test.go => orgs_custom_roles_test.go} | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) rename github/{org_custom_roles.go => orgs_custom_roles.go} (93%) rename github/{org_custom_roles_test.go => orgs_custom_roles_test.go} (89%) diff --git a/github/org_custom_roles.go b/github/orgs_custom_roles.go similarity index 93% rename from github/org_custom_roles.go rename to github/orgs_custom_roles.go index 7c60fea07b..17258c783d 100644 --- a/github/org_custom_roles.go +++ b/github/orgs_custom_roles.go @@ -29,7 +29,7 @@ type CustomRepoRoles struct { // // GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org string) (*OrganizationCustomRepoRoles, *Response, error) { - u := fmt.Sprintf("organizations/%v/custom_roles", org) + u := fmt.Sprintf("orgs/%v/custom_roles", org) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -44,3 +44,4 @@ func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org stri return customRepoRoles, resp, nil } +diff --git a/github/org_custom_roles.go b/github/org_custom_roles.go diff --git a/github/org_custom_roles_test.go b/github/orgs_custom_roles_test.go similarity index 89% rename from github/org_custom_roles_test.go rename to github/orgs_custom_roles_test.go index cfcb02611a..1638824c38 100644 --- a/github/org_custom_roles_test.go +++ b/github/orgs_custom_roles_test.go @@ -18,7 +18,7 @@ func TestOrganizationsService_ListCustomRepoRoles(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/organizations/o/custom_roles", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/custom_roles", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") fmt.Fprint(w, `{"total_count": 1, "custom_roles": [{ "id": 1, "name": "Developer"}]}`) }) @@ -48,3 +48,4 @@ func TestOrganizationsService_ListCustomRepoRoles(t *testing.T) { return resp, err }) } +diff --git a/github/org_custom_roles_test.go b/github/org_custom_roles_test.go From f08b039c8b191ad5fe4994547b677442f57b0712 Mon Sep 17 00:00:00 2001 From: joshuahancox <67631498+joshuahancox@users.noreply.github.com> Date: Mon, 23 May 2022 12:03:43 +0100 Subject: [PATCH 2/2] fix: remove wierd line --- github/orgs_custom_roles.go | 1 - github/orgs_custom_roles_test.go | 1 - 2 files changed, 2 deletions(-) diff --git a/github/orgs_custom_roles.go b/github/orgs_custom_roles.go index 17258c783d..d320a90514 100644 --- a/github/orgs_custom_roles.go +++ b/github/orgs_custom_roles.go @@ -44,4 +44,3 @@ func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org stri return customRepoRoles, resp, nil } -diff --git a/github/org_custom_roles.go b/github/org_custom_roles.go diff --git a/github/orgs_custom_roles_test.go b/github/orgs_custom_roles_test.go index 1638824c38..7042a5ec82 100644 --- a/github/orgs_custom_roles_test.go +++ b/github/orgs_custom_roles_test.go @@ -48,4 +48,3 @@ func TestOrganizationsService_ListCustomRepoRoles(t *testing.T) { return resp, err }) } -diff --git a/github/org_custom_roles_test.go b/github/org_custom_roles_test.go