Skip to content

Instantly share code, notes, and snippets.

@shollingsworth
Created May 9, 2023 18:07
Show Gist options
  • Save shollingsworth/19de1317147a009955a7adbc0cc5c3cd to your computer and use it in GitHub Desktop.
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
#!/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