Last active
January 22, 2024 17:13
-
-
Save UnixSage/210c23e0c37e10685c4b0ded7e40be3a to your computer and use it in GitHub Desktop.
Simple Script to get a list of BitBucket repos for a given team
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
#!/bin/bash | |
USER="##USER_NAME_NOT_EMAIL##" | |
SECRET="##SECRET##" | |
TEAM="##TEAMNAME##" | |
CACHE="/tmp/repolist.$$" | |
REPOFILE="/tmp/repolist.txt" | |
URL="https://api.bitbucket.org/2.0/repositories/${TEAM}?pagelen=100" | |
rm ${REPOFILE} | |
while [ ! ${URL} == "null" ] | |
do | |
curl -q#u "${USER}:${SECRET}" "$URL" > ${CACHE} | |
jq -r '.values[].full_name' < ${CACHE} | sed 's~^.*/~~' >> ${REPOFILE} | |
URL=`jq -r .next ${CACHE}` | |
done | |
rm ${CACHE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment