diff --git a/gh-graphql-repos-another-users-permissions-example.sh b/gh-graphql-repos-another-users-permissions-example.sh new file mode 100755 index 00000000..7cd63eb9 --- /dev/null +++ b/gh-graphql-repos-another-users-permissions-example.sh @@ -0,0 +1,46 @@ +. ./.gh-api-examples.conf + +# https://cli.github.com/manual/gh_api +# Demonstrates pagination for gh api + +export GH_TOKEN=${GITHUB_TOKEN} + +gh api graphql --paginate -F owner="${org}" -F is_archived=false -f query=' +query ($owner: String!, $after: String, $is_archived: Boolean!) { + organization(login: $owner) { + repositories( + isArchived: $is_archived + first: 100 + orderBy: {field: PUSHED_AT, direction: DESC} + after: $after + ) { + nodes { + name + description + url + collaborators(first: 5, affiliation: ALL) { + edges { + permission + node { + id + login + name + email + } + } + pageInfo { + hasNextPage + endCursor + } + } + pushedAt + } + pageInfo { + endCursor + hasNextPage + } + } + } + } +' +