Created
November 6, 2018 19:07
-
-
Save yshalsager/f0da4f541ad6289f6c55ffde9b279340 to your computer and use it in GitHub Desktop.
This script counts the total releases downloads from all repositories in a certain organization
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
curl -s https://api.github.com/orgs/$1/repos | egrep '"name"' | cut -d '"' -f4 > repos | |
cat repos | while read repo; do | |
curl -s https://api.github.com/repos/$1/$repo/releases | egrep 'download_count' | cut '-d:' -f 2 | sed 's/,/+/' | xargs echo | xargs -I N echo N 0 | bc >> counts | |
done | |
cat counts | while read repo; do | |
perl -nle '$sum += $_ } END { print $sum' | |
done | |
rm repos counts 2> /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment