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
# clone all public and private repos for a github org. user must have full access to repos. | |
USERNAME=someuser | |
ORGNAME=myorg | |
# personal access token | |
TOKEN=abc123tokenstringhere | |
# num repos to return per page - max 100 | |
PERPAGE=100 | |
BASEURL="https://api.github.com/orgs/${ORGNAME}/repos" | |
TOTALPAGES=`curl -I -i -u $USERNAME:$TOKEN -H "Accept: application/vnd.github.v3+json" -s ${BASEURL}\?per_page\=${PERPAGE} | grep -i link: 2>/dev/null|sed 's/link: //g'|awk -F',' -v ORS='\n' '{ for (i = 1; i <= NF; i++) print $i }'|grep -i last|awk '{print $1}' | tr -d '\<\>' | tr '\?\&' ' '|awk '{print $3}'| tr -d '=;page'` |
OlderNewer