I am really struggling to get anything sensible out of the GitHub GraphQL api... I want to get a list of repos and the permission levels for a team. So far I have
Q= """query {
organization(login: "MY_ORG") {
team(slug:"MY_TEAM") {
name
repositories(first:3){
nodes {
name
}
edges {
permission
}
}
}
}
}"""
which returns
{'data': {'organization': {'team': {'name': 'MY_TEAM',
'repositories': {'nodes': [{'name': 'REPO1'},
{'name': 'REPO2'},
{'name': 'REPO3'}],
'edges': [{'permission': 'ADMIN'},
{'permission': 'ADMIN'},
{'permission': 'ADMIN'}]}}}}}
But I cannot see any way to list the permission and the repo name together as there is no way to go from a teamrepositoryedge to a repository node or vice versa :/
I feel I am missing something obvious and just not seeing it.
Eventually found that there is a node in the edge it just isn't documented like others are :(
query {
organization(login: "MY_ORG") {
team(slug:"MY_TEAM"){
name
repositories(first:3){
edges {
permission
node {
name
}
}
}
}
}
}
{'data': {'organization': {'team': {'name': 'MY_TEAM',
'repositories': {'edges': [{'permission': 'ADMIN',
'node': {'name': 'REPO1'}},
{'permission': 'ADMIN', 'node': {'name': 'REPO2'}},
{'permission': 'ADMIN', 'node': {'name': 'REPO3'}}]}}}}}