Created
September 29, 2020 10:39
-
-
Save nektro/bdf37b3035ffc8567de5af105adb6e14 to your computer and use it in GitHub Desktop.
./get_github_user.sh <username>
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
#!/usr/bin/env bash | |
c1=1 | |
c2=0 | |
mkdir -p $1 | |
cd $1 | |
IFS=$'\n' | |
uid="$GITHUB_CLIENT" | |
sec="$GITHUB_SECRET" | |
while : | |
do | |
echo $c1 | |
api_results=$(curl -s -u "$uid:$sec" https://api.github.com/users/$1/repos\?page=$c1 | jq --compact-output '.[]') | |
for line in $api_results | |
do | |
name=$(echo $line | jq --raw-output '.name') | |
echo "Cloning $1/$name..." | |
git clone -q "https://github.com/$1/$name" | |
c2=$(($c2+1)) | |
done | |
if [[ "$c2" == '0' ]]; then | |
break | |
fi | |
c1=$(($c1+1)) | |
c2=0 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment