-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
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#L60
As 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 API
In our case, we are using custom roles that might have empty permissions set for flexibility's sake to extend them in the future