-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create Custom Repository Role without permissions #3226
Comments
It sounds like we need a new endpoint with an additional private struct which removes the go-github/github/orgs_properties.go Lines 112 to 116 in 474a48f
@andriyun - would you like to make a PR to address this, or shall I open this up to other contributors to this repo? |
I'll be glad to submit PR with changes to fix it :) |
Thank you, @andriyun ! It's yours. |
…oogle#3226 Signed-off-by: Andríyun <[email protected]>
…oogle#3226 Signed-off-by: Andríyun <[email protected]>
Hey @gmlewis I've added PR with changes #3235 |
So I was thinking that this could be achieved without breaking the current API by adding separate endpoint(s) that specifically handle the Does that make sense? I've looked at #3235 but was hoping to not break the current API, which that PR does. |
…oogle#3226 Signed-off-by: Andríyun <[email protected]>
I understand your point now. It makes perfect sense. I changed the PR in such a way, that it doesn't break the current API. |
…issions google#3226 Signed-off-by: Andríyun <[email protected]>
…issions google#3226 Signed-off-by: Andríyun <[email protected]>
In the current implementation, the client allows you to request a Custom Repository Role for an Organization without specifying the required keys.
CreateCustomRepoRole use as argument
opts *CreateOrUpdateCustomRoleOptions
which has all key as optional https://github.com/google/go-github/blob/master/github/orgs_custom_roles.go#L60As a result, the client will allow the creation request to GitHub and will fail with an error.
In most cases, what is missing might be clear and reasonable.
But it doesn't work when creating a custom role with no permissions. In other words when CreateCustomRepoRole gets an empty array as a
Permission
key.Due to omitempty in JSON tag of the
Permission
key, an empty array as value is omitted from the final request to GitHub API, while it is required by the APIIn our case, we are using custom roles that might have empty permissions set for flexibility's sake to extend them in the future
The text was updated successfully, but these errors were encountered: