Created
May 9, 2023 18:07
-
-
Save shollingsworth/19de1317147a009955a7adbc0cc5c3cd to your computer and use it in GitHub Desktop.
output all of a users github starred repositories using gh api graphql call
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
#!/usr/bin/env bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# get all my starred repos | |
getstars() { | |
query="query(\$endCursor: String) { | |
viewer { | |
starredRepositories(first: 100, after: \$endCursor) { | |
pageInfo { | |
hasNextPage | |
endCursor | |
} | |
nodes { | |
nameWithOwner | |
} | |
} | |
} | |
}" | |
gh api graphql --paginate -f query="$query" 2>/dev/null | jq -r '.data.viewer.starredRepositories.nodes[].nameWithOwner' | |
} | |
getstars |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment