Skip to content

Instantly share code, notes, and snippets.

@chrisxaustin
Created May 2, 2024 12:40
Show Gist options
  • Save chrisxaustin/a564f23972ea3d514d3e752684f33a04 to your computer and use it in GitHub Desktop.
Save chrisxaustin/a564f23972ea3d514d3e752684f33a04 to your computer and use it in GitHub Desktop.
#!/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