hub4j / github-api

Java API for GitHub
https://github-api.kohsuke.org/
MIT License
1.12k stars 715 forks source link

Can't Iterate over ghRepo.listCollaborators() #1852

Closed MouadhKh closed 3 weeks ago

MouadhKh commented 3 weeks ago

Description Accessing single collaborators by iterating over ghRepo.listCollaborators() is not possible for some repositories (all public) The detailed message looks : Server returned HTTP response code: -1, message: 'null' for URL: www.reposUrl.com

To Reproduce It doesn't matter which token I use ( classic token with all permissions/Fine-grained token with all permissions). For some repositories, it is not possible to go over the collaborators. The result of the following curl varies depending on the used token(classic/new) curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer TOKEN_PLACEHOLDER" \ -H "X-GitHub-Api-Version: 2022-11-28" \ URL

Classic PAT --> Must have push access to view repository collaborators. Fine grained token --> Resource not accessible by personal access token

The first displayed error message allude to missing permissions, which I think is wrong since the repository is publicly accessible The second error message is more confusing and contradicts the documentation(https://docs.github.com/rest/collaborators/collaborators#list-repository-collaborators)

Expected behavior Can access collaborators of all public repositories

Additional context The given repository is a special case because it is archived(should be readable nevertheless). But this problem persists with other non-archived repositories aswell