Created
November 22, 2019 20:38
-
-
Save spg/1e6e3dfa711cd3dc427532480e9f986b to your computer and use it in GitHub Desktop.
Revisions
-
spg created this gist
Nov 22, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/bin/sh GH_TOKEN=$1 curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=1\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=2\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=3\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=4\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=5\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=6\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=7\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=8\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=9\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=10\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=11\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=12\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=13\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=14\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=15\&per_page\=100 | jq -r '.[] | .name' >> repos.txt curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=16\&per_page\=100 | jq -r '.[] | .name' >> repos.txt echo "repo,count,uniques" >> views.csv cat $repos.txt | while read reponame do DATA=`curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/repos/sindresorhus/$reponame/traffic/views?per=week | jq -r '"\(.count),\(.uniques)"'` echo "$reponame,$DATA" >> views.csv done