Skip to content

Instantly share code, notes, and snippets.

@YOU54F
Last active Oct 24, 2020
Embed
What would you like to do?
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