Ability to get the Team collaborators for an organisation's repositories



I’m trying to query all of the repositories within an organisation, and for each one list the users which have been given specific permissions to the repository, the level of permission they have been granted, and whether they are members of the organsation. I’m also trying to list the same for Teams.

So far I’ve got:

query {
  organization(login: "x") {
    repositories(first: 100) {
      nodes {
        usersWithSpecialAccess: collaborators(affiliation: DIRECT, first: 100) {
          edges {
            node {

I’d like to have almost the same thing for teams as the usersWithSpecialAccess above (including the filter of affiliation: DIRECT argument (as all teams will have read access).

I’ve also tried going in the other direction, first into Teams, and then their repositories, but as some repositories are currently owned by multiple teams I’d rather look at it per repository.

For context, we have a default ‘read’ permission policy, a team (and certain users) should be the ‘owner’ of their repos (write/admin permissions). So we’re trying to list all repos along with their owner(s) team(s) & users.

I’ve built similar reports using the v3 API, but it takes a lot of requests, whereas I can see that it could be trivial with v4 if the correct relationships were added.


Thanks for the detailed use-case, I can definitely see where this would be made much simpler in GraphQL. I’ve added this to our internal Schema Requests list.


@kytrinyx I added a comment to a similar feature request, but realized this one is a bit more recent and that the OP’s use case is quite similar to my own. In case it’s helpful to hear from more users, this schema change would be quite useful.