cargo-binstall/cleanup-cache.sh
Jiahao XU cc87fe062d
ci: Rm merge queue cache in cache-cleanup.yml (#1129)
since they cannot be reused

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-05 12:54:01 +00:00

23 lines
514 B
Bash
Executable file

#!/bin/bash
set -uxo pipefail
REPO="${REPO?}"
BRANCH="${BRANCH?}"
while true; do
echo "Fetching list of cache key for $BRANCH"
cacheKeysForPR="$(gh actions-cache list -R "$REPO" -B "$BRANCH" -L 100 | cut -f 1)"
if [ -z "$cacheKeysForPR" ]; then
break
fi
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
echo Removing "$cacheKey"
gh actions-cache delete "$cacheKey" -R "$REPO" -B "$BRANCH" --confirm
done
done
echo "Done cleaning up $BRANCH"