Last active
November 24, 2024 14:45
-
-
Save chrisxaustin/a564f23972ea3d514d3e752684f33a04 to your computer and use it in GitHub Desktop.
List the github contributors for a repo using the stats/contributors api.
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 characters
#!/bin/bash | |
org=foo | |
pause=2 | |
retries=6 | |
for repo in $(./repos|sort); do | |
out=stats/contrib/$repo | |
for i in 1 2 3 4 5 6; do | |
gh api --paginate -H "Accept: application/vnd.github+json" /repos/$org/$repo/stats/contributors | jq > $out | |
lines=$(cat $out | wc -l) | |
if [[ $lines -gt 2 ]]; then | |
break; | |
fi | |
sleep $pause | |
done | |
if [[ $lines -gt 2 ]]; then | |
echo $repo has $lines lines of data, attempt $i | |
else | |
echo $repo has $lines lines of data - FAILED to load data | |
fi | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment