MCPcopy Index your code
hub / github.com/google/go-github / IsCollaborator

Method IsCollaborator

github/repos_collaborators.go:83–93  ·  view source on GitHub ↗

IsCollaborator checks whether the specified GitHub user has collaborator access to the given repo. Note: This will return false if the user is not a collaborator OR the user is not a GitHub user. GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#check-i

(ctx context.Context, owner, repo, user string)

Source from the content-addressed store, hash-verified

81//
82//meta:operation GET /repos/{owner}/{repo}/collaborators/{username}
83func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error) {
84 u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
85 req, err := s.client.NewRequest(ctx, "GET", u, nil)
86 if err != nil {
87 return false, nil, err
88 }
89
90 resp, err := s.client.Do(req, nil)
91 isCollab, err := parseBoolResponse(err)
92 return isCollab, resp, err
93}
94
95// RepositoryPermissionLevel represents the permission level an organization
96// member has for a given repository.

Calls 3

parseBoolResponseFunction · 0.85
NewRequestMethod · 0.80
DoMethod · 0.45