feat!: Support querying organization custom roles#3129
feat!: Support querying organization custom roles#3129gmlewis merged 3 commits intogoogle:masterfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3129 +/- ##
==========================================
- Coverage 97.72% 92.90% -4.82%
==========================================
Files 153 170 +17
Lines 13390 11463 -1927
==========================================
- Hits 13085 10650 -2435
- Misses 215 723 +508
Partials 90 90 ☔ View full report in Codecov by Sentry. |
Added support for querying, creating, updating and deleting organization custom roles.
1e8c944 to
83cac3c
Compare
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @tomfeigin !
Just one addition, please, then I think we will be ready for a second LGTM+Approval before merging.
|
(Also, there is no need to force push in this repo - we always squash&merge - see CONTRIBUTING.md for details.) |
github/orgs_custom_roles.go
Outdated
| // GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#update-a-custom-organization-role | ||
| // | ||
| //meta:operation PATCH /orgs/{org}/organization-roles/{role_id} | ||
| func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org, roleID string, opts *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) { |
There was a problem hiding this comment.
According to: https://docs.github.com/en/rest/orgs/organization-roles?apiVersion=2022-11-28#update-a-custom-organization-role
roleID should be an integer.
| func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org, roleID string, opts *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) { | |
| func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org string, roleID int64, opts *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) { |
github/orgs_custom_roles.go
Outdated
| // GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#delete-a-custom-organization-role | ||
| // | ||
| //meta:operation DELETE /orgs/{org}/organization-roles/{role_id} | ||
| func (s *OrganizationsService) DeleteCustomOrgRole(ctx context.Context, org, roleID string) (*Response, error) { |
There was a problem hiding this comment.
Same here: https://docs.github.com/rest/orgs/organization-roles#delete-a-custom-organization-role
| func (s *OrganizationsService) DeleteCustomOrgRole(ctx context.Context, org, roleID string) (*Response, error) { | |
| func (s *OrganizationsService) DeleteCustomOrgRole(ctx context.Context, org string, roleID int64) (*Response, error) { |
There was a problem hiding this comment.
I'll change it but it is aligned with DeleteCustomRepoRole
There was a problem hiding this comment.
Ah, bummer. Looks like I didn't catch it before on the other one. 😞
Well, since this is already a breaking API change, do you want to go ahead and make it consistent and fix the older one(s) too?
There was a problem hiding this comment.
I prefer to do that in another PR because here I am just introducing new stuff so it won't break existing usage
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @tomfeigin !
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
|
@gmlewis this specific PR is not a breaking a change as it only introduces new API wrappers (I am pretty sure 🙃 ) can you remove the label please? |
| // | ||
| //meta:operation POST /orgs/{org}/custom-repository-roles | ||
| func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, opts *CreateOrUpdateCustomRoleOptions) (*CustomRepoRoles, *Response, error) { | ||
| func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, opts *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) { |
There was a problem hiding this comment.
@tomfeigin - if I'm not mistaken, this line and line 203 below are both breaking API changes, as code written by a user of this repo that calls one or both of these endpoints will no longer compile correctly without changing their code. Agreed?
There was a problem hiding this comment.
Oh you are right, should I keep the previous naming then?
There was a problem hiding this comment.
Let's just have the breaking change, I'll fix the other APIs to use the int64 ID
There was a problem hiding this comment.
Well, honestly I don't have a problem making breaking API changes, which I suppose might be obvious from the current version number of this repo. 😂
Also, I think it is always a good idea to make things clearer and easier-to-understand for users of this repo... so I think your name change here was perfectly appropriate and that's also why I recommended fixing the bad field type while we are making a breaking API change.
So I'll leave it up to you, but I think the breaking API change is appropriate and am willing to move forward with it.
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @tomfeigin !
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
|
Thank you, @gsaraf ! |
Added support for querying, creating, updating and deleting organization custom roles.
BREAKING CHANGE:
CreateOrUpdateCustomRoleOptionshas been renamed toCreateOrUpdateCustomRepoRoleOptionsandroleIDhas been changed from typestringtoint64.