Skip to content

Instantly share code, notes, and snippets.

@jonjozwiak
Created March 14, 2025 18:22
Show Gist options
  • Select an option

  • Save jonjozwiak/55feedde72ff21610a8806af24bf90c2 to your computer and use it in GitHub Desktop.

Select an option

Save jonjozwiak/55feedde72ff21610a8806af24bf90c2 to your computer and use it in GitHub Desktop.
API call to get teams permissions
gh api graphql --paginate -f owner='your-organization-here' -f repo='your-repo-here' -f affiliation='ALL' -f query='
query ($owner: String!, $repo: String!, $affiliation: CollaboratorAffiliation!, $endCursor: String) {
repository(owner:$owner, name:$repo) {
name
owner {
login
}
collaborators(first: 100, affiliation: $affiliation, after: $endCursor) {
pageInfo {
endCursor
hasNextPage
}
edges {
node {
login
}
permission
permissionSources {
permission
source {
... on Team {
type: __typename
name: slug
}
... on Repository {
type: __typename
name: name
}
... on Organization {
type: __typename
name: login
}
}
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment