Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple Script to get a list of BitBucket repos for a given team
#!/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