summaryrefslogtreecommitdiff
path: root/shell-scripts/azdo-throwaway-clone
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-03-13 17:29:58 +0100
committerMike Vink <mike1994vink@gmail.com>2023-03-13 17:29:58 +0100
commit177127162d6b1d52dc500a969e8222d12f81c957 (patch)
treed533524cc5b7d610478865a940607e3d568d1c87 /shell-scripts/azdo-throwaway-clone
parent4524eeb9e4b4289fa4f4dd1c0172cf22eaed428c (diff)
make conditional on username later
Diffstat (limited to 'shell-scripts/azdo-throwaway-clone')
-rw-r--r--shell-scripts/azdo-throwaway-clone6
1 files changed, 5 insertions, 1 deletions
diff --git a/shell-scripts/azdo-throwaway-clone b/shell-scripts/azdo-throwaway-clone
index 10a75da..099829f 100644
--- a/shell-scripts/azdo-throwaway-clone
+++ b/shell-scripts/azdo-throwaway-clone
@@ -5,6 +5,9 @@ LIST_PROJECTS="/_apis/projects?api-version=7.1-preview.4"
AUTH_HEADER="Authorization: Basic $WORK_AZDO_GIT_AUTH"
LIST_REPOSITORIES="/_apis/git/repositories?api-version=7.1-preview.1"
DIR_THROWAWAY_REPOS="$HOME/ephemeral-projects/"
+if [ ! -d $DIR_THROWAWAY_REPOS ]; then
+ mkdir -p $DIR_THROWAWAY_REPOS
+fi
MAX_REPOS=20
COUNT=$(find "$DIR_THROWAWAY_REPOS" -mindepth 1 -maxdepth 1 -type d | wc -l)
@@ -13,7 +16,7 @@ then
STALE=$(( COUNT - MAX_REPOS ))
OLDEST=$(find "$DIR_THROWAWAY_REPOS" -mindepth 1 -maxdepth 1 -type d -printf '%T@ %p\n' 2>/dev/null \
| sort -n | head -n$STALE | cut -d' ' -f2)
-
+
for dir in $OLDEST
do
rm -i -r $dir
@@ -21,6 +24,7 @@ then
fi
+echo "curl -s -H \"$AUTH_HEADER\" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS"
curl -s -H "$AUTH_HEADER" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS \
| jq '
.value[].name