Skip to content

Instantly share code, notes, and snippets.

@HotFusionMan
Forked from sebble/stars.sh
Created October 9, 2018 23:14
Show Gist options
  • Save HotFusionMan/21d8049ca7a1b2efefebc3263eaafb49 to your computer and use it in GitHub Desktop.
Save HotFusionMan/21d8049ca7a1b2efefebc3263eaafb49 to your computer and use it in GitHub Desktop.
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$(($STARS/100+1))
echo You have $STARS starred repositories.
echo
for PAGE in `seq $PAGES`; do
curl -sH "Accept: application/vnd.github.v3.star+json" "https://api.github.com/users/$USER/starred?per_page=100&page=$PAGE"|jq -r '.[]|[.starred_at,.repo.full_name]|@tsv'
done
echo
# curl -sI https://api.github.com/users/$USER/starred?per_page=100|egrep '^Link: '|tr , \\n|grep 'rel="next"'|egrep -o '<https[^>]+'|tr -d \<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment