Skip to content

Commit e0bb535

Browse files
authored
Update custom repo roles URL (#2702)
Fixes: #2700.
1 parent 14bb610 commit e0bb535

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

github/orgs_custom_roles.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type CustomRepoRoles struct {
3232
//
3333
// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization
3434
func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org string) (*OrganizationCustomRepoRoles, *Response, error) {
35-
u := fmt.Sprintf("orgs/%v/custom_roles", org)
35+
u := fmt.Sprintf("orgs/%v/custom-repository-roles", org)
3636

3737
req, err := s.client.NewRequest("GET", u, nil)
3838
if err != nil {
@@ -59,9 +59,9 @@ type CreateOrUpdateCustomRoleOptions struct {
5959
// CreateCustomRepoRole creates a custom repository role in this organization.
6060
// In order to create custom repository roles in an organization, the authenticated user must be an organization owner.
6161
//
62-
// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#create-a-custom-role
62+
// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#create-a-custom-repository-role
6363
func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, opts *CreateOrUpdateCustomRoleOptions) (*CustomRepoRoles, *Response, error) {
64-
u := fmt.Sprintf("orgs/%v/custom_roles", org)
64+
u := fmt.Sprintf("orgs/%v/custom-repository-roles", org)
6565

6666
req, err := s.client.NewRequest("POST", u, opts)
6767
if err != nil {
@@ -80,9 +80,9 @@ func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org str
8080
// UpdateCustomRepoRole updates a custom repository role in this organization.
8181
// In order to update custom repository roles in an organization, the authenticated user must be an organization owner.
8282
//
83-
// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#update-a-custom-role
83+
// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#update-a-custom-repository-role
8484
func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org, roleID string, opts *CreateOrUpdateCustomRoleOptions) (*CustomRepoRoles, *Response, error) {
85-
u := fmt.Sprintf("orgs/%v/custom_roles/%v", org, roleID)
85+
u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID)
8686

8787
req, err := s.client.NewRequest("PATCH", u, opts)
8888
if err != nil {
@@ -101,9 +101,9 @@ func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org, ro
101101
// DeleteCustomRepoRole deletes an existing custom repository role in this organization.
102102
// In order to delete custom repository roles in an organization, the authenticated user must be an organization owner.
103103
//
104-
// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#delete-a-custom-role
104+
// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#delete-a-custom-repository-role
105105
func (s *OrganizationsService) DeleteCustomRepoRole(ctx context.Context, org, roleID string) (*Response, error) {
106-
u := fmt.Sprintf("orgs/%v/custom_roles/%v", org, roleID)
106+
u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID)
107107

108108
req, err := s.client.NewRequest("DELETE", u, nil)
109109
if err != nil {

github/orgs_custom_roles_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestOrganizationsService_ListCustomRepoRoles(t *testing.T) {
1818
client, mux, _, teardown := setup()
1919
defer teardown()
2020

21-
mux.HandleFunc("/orgs/o/custom_roles", func(w http.ResponseWriter, r *http.Request) {
21+
mux.HandleFunc("/orgs/o/custom-repository-roles", func(w http.ResponseWriter, r *http.Request) {
2222
testMethod(t, r, "GET")
2323
fmt.Fprint(w, `{"total_count": 1, "custom_roles": [{ "id": 1, "name": "Developer", "base_role": "write", "permissions": ["delete_alerts_code_scanning"]}]}`)
2424
})
@@ -53,7 +53,7 @@ func TestOrganizationsService_CreateCustomRepoRole(t *testing.T) {
5353
client, mux, _, teardown := setup()
5454
defer teardown()
5555

56-
mux.HandleFunc("/orgs/o/custom_roles", func(w http.ResponseWriter, r *http.Request) {
56+
mux.HandleFunc("/orgs/o/custom-repository-roles", func(w http.ResponseWriter, r *http.Request) {
5757
testMethod(t, r, "POST")
5858
fmt.Fprint(w, `{"id":8030,"name":"Labeler","description":"A role for issue and PR labelers","base_role":"read","permissions":["add_label"]}`)
5959
})
@@ -96,7 +96,7 @@ func TestOrganizationsService_UpdateCustomRepoRole(t *testing.T) {
9696
client, mux, _, teardown := setup()
9797
defer teardown()
9898

99-
mux.HandleFunc("/orgs/o/custom_roles/8030", func(w http.ResponseWriter, r *http.Request) {
99+
mux.HandleFunc("/orgs/o/custom-repository-roles/8030", func(w http.ResponseWriter, r *http.Request) {
100100
testMethod(t, r, "PATCH")
101101
fmt.Fprint(w, `{"id":8030,"name":"Updated Name","description":"Updated Description","base_role":"read","permissions":["add_label"]}`)
102102
})
@@ -137,7 +137,7 @@ func TestOrganizationsService_DeleteCustomRepoRole(t *testing.T) {
137137
client, mux, _, teardown := setup()
138138
defer teardown()
139139

140-
mux.HandleFunc("/orgs/o/custom_roles/8030", func(w http.ResponseWriter, r *http.Request) {
140+
mux.HandleFunc("/orgs/o/custom-repository-roles/8030", func(w http.ResponseWriter, r *http.Request) {
141141
testMethod(t, r, "DELETE")
142142
w.WriteHeader(http.StatusNoContent)
143143
})

0 commit comments

Comments
 (0)