Created
January 24, 2022 01:03
-
-
Save yknx4/1bc073e83501df97b6c15964079be5d3 to your computer and use it in GitHub Desktop.
Get Team SSH Keys from Github Organization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gh api graphql -F login='ORG' -F team='TEAM' -f query=' | |
query ($login: String!, $team: String!) { | |
organization(login: $login) { | |
team(slug: $team) { | |
members(first: 100) { | |
edges { | |
node { | |
name | |
login | |
publicKeys(first: 100) { | |
edges { | |
node { | |
key | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
' --jq 'getpath(["data","organization", "team", "members", "edges"]) | map(.node | .publicKeys = (.publicKeys.edges | map(.node.key))) | map(select(.publicKeys | length >= 1)) | map({key:.publicKeys[], login}) | map(.key + " " + .login) | join("\n")' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment