go-github icon indicating copy to clipboard operation
go-github copied to clipboard

how to add AddCollaborator by email address?

Open yuseferi opened this issue 3 years ago • 3 comments

I'm looking for a way to add collaborators by email address.

I checked AddCollaborator only support username,

opt := &github.RepositoryAddCollaboratorOptions{Permission: "push"}
collaboratorInvitation, _, err := client.Repositories.AddCollaborator(ctx, orgName, name, "GITHUB_USERNAME", opt)
	

is there any method to get username by email address or add AddCollaborator by email addrress?

Thanks,

yuseferi avatar Mar 24 '22 16:03 yuseferi

is there any method to get username by email address or add AddCollaborator by email addrress?

Going back to the official GitHub v3 API documentation: https://docs.github.com/en/rest/reference/collaborators#add-a-repository-collaborator and searching for "email", it looks like this is not possible via the API, and therefore this repo (which is just a Go client for the API) will not be able to do that. Sorry.

gmlewis avatar Mar 24 '22 16:03 gmlewis

thank you @gmlewis ! it's for adding collaborator,

is there any other api to get username based on the useremail?

yuseferi avatar Mar 24 '22 19:03 yuseferi

Not that I know of. You probably will want to contact GitHub Tech Support to get an answer to this question. Feel free to report back here what you find out from them.

gmlewis avatar Mar 24 '22 19:03 gmlewis