Created
January 31, 2021 19:07
-
-
Save kaar/a02198f000f4eaade5d5aa8bf57ae069 to your computer and use it in GitHub Desktop.
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 | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
ACCESS_TOKEN=$(<access-token) | |
HEADER_ACCEPT="Accept: application/vnd.github.v3+json" | |
HEADER_AUTH="Authorization: token ${ACCESS_TOKEN}" | |
ORG=$1 | |
url=https://api.github.com/orgs/$ORG/repos | |
pages=$(curl --silent -I -H "$HEADER_AUTH" -H "$HEADER_ACCEPT" "$url" | grep -Po "(?<=page=)[0-9]+" | tail -1) | |
for i in `seq 1 $pages` | |
do | |
curl --silent -H "$HEADER_AUTH" -H "$HEADER_ACCEPT" "${url}?page=${i}" \ | |
| jq -r .[].name | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment