List repository teams for GraphQL?

I am converting my app API calls from Github V3 to Github v4.

Github V3 Supports the API for List repository teams. What is the same alternative for Github V4?

Regards
Parithiban G

@parithiban - The Repository object doesn’t have a team connection available for listing the teams that have access to some repository. If you’re interested in such a connection, we suggest sharing your interest with our product team for their review so they can consider it for future iterations.

As an alternative approach, it may be worth querying for a specific organization, expanding on its teams, and further expanding on the repositories it has access to.

Here’s an example query––be sure to replace name_of_organization with the name of the organization you’re interested in:

query {
  organization(login: "name_of_organization") {
    teams(first: 10) {
      edges {
        node {
          name
          repositories(first: 10) {
            edges {
              node {
                name
              }
            }
          }
        }
      }
    }
  }
}

Thanks, @francisfuzz for your reply. I have already gone through this in the GrpahQL documentation. But this would be a reverse logic for me to achieve as I am looping through repos in the organization to do certain actions and fetching the team name is one of the action of it. It would be more helpful if we can achieve it as we did in V3 API calls.

Thanks for following up on this @parithiban. I hear what you’re saying around how that approach would actually be more work in GraphQL API than in the REST API v3. We’re not able to share any specific timelines around if or when this behavior will change such that the appropriate connections are exposed to get the information you’re looking for, though our product team is keen to hear about these sorts of requests further. For now, using the REST API v3 endpoint is your best bet for reliably obtaining the information you’re after. I hope this helps!

1 Like