Last active
October 24, 2020 02:21
-
-
Save YOU54F/7fef07104226da043d3a0dacfe4852ef to your computer and use it in GitHub Desktop.
Get starred repos and create a markdown file
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
#!/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 |
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
./getStarredRepos.sh > starred.txt | |
./processStarredRepos.sh > starred.MD |
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
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