18 lines
605 B
Bash
Executable File
18 lines
605 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# BUG: need to repeat until all repos are gone...it's not getting all of them
|
|
|
|
source config.sh
|
|
|
|
for ((i=1; ; i+=1)); do
|
|
contents=$(curl -sX GET "${GT_DOMAIN}/api/v1/user/repos?limit=30&page=${i}" -H "Accept: application/json" -H "Authorization: token ${GT_TOKEN}")
|
|
if [ "$(echo $contents | jq -e '. | length == 0')" == "true" ]; then
|
|
break
|
|
fi
|
|
for repo in $(echo "$contents" | jq -r '.[].name')
|
|
do
|
|
echo $repo
|
|
curl -sX DELETE "${GT_DOMAIN}/api/v1/repos/${GT_USER}/${repo}" -H "Accept: application/json" -H "Authorization: token ${GT_TOKEN}"
|
|
done
|
|
done
|