Skip to content

Instantly share code, notes, and snippets.

@ankjevel
Last active January 5, 2021 14:52
Show Gist options
  • Save ankjevel/e717add03c530717b36066a070b794ed to your computer and use it in GitHub Desktop.
Save ankjevel/e717add03c530717b36066a070b794ed to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
token=xxx
org=Springworks
per_page=100
url="https://api.github.com/orgs/${org}/repos?per_page=${per_page}"
pages=$(curl -H "Authorization: token ${token}" --silent "${url}" -I | awk '$1=/Link:/ {print $4}' | sed 's/.*page=//' | sed 's/\>;//')
for page in $(seq 1 ${pages:-1})
do
for repo in $(curl -H "Authorization: token ${token}" --silent "${url}&page=${page}" | jq '.[] | select(.archived == false) | .ssh_url' | sed 's/\"//g')
do
git clone $repo -q
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment