Skip to content

Instantly share code, notes, and snippets.

@YOU54F
Last active October 24, 2020 02:21
Show Gist options
  • Save YOU54F/7fef07104226da043d3a0dacfe4852ef to your computer and use it in GitHub Desktop.
Save YOU54F/7fef07104226da043d3a0dacfe4852ef to your computer and use it in GitHub Desktop.
Get starred repos and create a markdown file
#!/bin/bash
USER=${1:-YOU54F}
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=$((658/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
./getStarredRepos.sh > starred.txt
./processStarredRepos.sh > starred.MD
while read p; do
description=`curl -s https://github.com/$p | egrep 'meta name="description"' | cut -c39- | rev | cut -c3- | rev`
removeContributor=" Contribute to $p development by creating an account on GitHub."
removeRepoName=" - $p"
removedContributor=$(echo "$description" | sed "s@$removeContributor@@")
formattedDescription=$(echo "$removedContributor" | sed "s@$removeRepoName@@")
echo "- [$p](https://github.com/$p)"
echo " - $formattedDescription"
done <starredRepos.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment