mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-19 12:08:43 +00:00
ci: Rm merge queue cache in cache-cleanup.yml
(#1129)
since they cannot be reused Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
3cf2528273
commit
cc87fe062d
2 changed files with 13 additions and 3 deletions
12
.github/workflows/cache-cleanup.yml
vendored
12
.github/workflows/cache-cleanup.yml
vendored
|
@ -15,14 +15,26 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
run: |
|
run: |
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
gh extension install actions/gh-actions-cache
|
gh extension install actions/gh-actions-cache
|
||||||
|
|
||||||
export REPO="${{ github.repository }}"
|
export REPO="${{ github.repository }}"
|
||||||
|
|
||||||
|
# Setting this to not fail the workflow while deleting cache keys.
|
||||||
|
set +e
|
||||||
|
|
||||||
|
# Remove pull requests cache, since they cannot be reused
|
||||||
gh pr list --state closed -L 20 --json number --jq '.[]|.number' | (
|
gh pr list --state closed -L 20 --json number --jq '.[]|.number' | (
|
||||||
while IFS='$\n' read -r closed_pr; do
|
while IFS='$\n' read -r closed_pr; do
|
||||||
BRANCH="refs/pull/${closed_pr}/merge" ./cleanup-cache.sh
|
BRANCH="refs/pull/${closed_pr}/merge" ./cleanup-cache.sh
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
# Remove merge queue cache, since they cannot be reused
|
||||||
|
gh actions-cache list -L 100 | cut -f 3 | grep 'gh-readonly-queue' | sort -u | (
|
||||||
|
while IFS='$\n' read -r branch; do
|
||||||
|
BRANCH="$branch" ./cleanup-cache.sh
|
||||||
|
done
|
||||||
|
)
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -7,14 +7,12 @@ BRANCH="${BRANCH?}"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
echo "Fetching list of cache key for $BRANCH"
|
echo "Fetching list of cache key for $BRANCH"
|
||||||
cacheKeysForPR="$(gh actions-cache list -R "$REPO" -B "$BRANCH" -L 100 | cut -f 1 )"
|
cacheKeysForPR="$(gh actions-cache list -R "$REPO" -B "$BRANCH" -L 100 | cut -f 1)"
|
||||||
|
|
||||||
if [ -z "$cacheKeysForPR" ]; then
|
if [ -z "$cacheKeysForPR" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Setting this to not fail the workflow while deleting cache keys.
|
|
||||||
set +e
|
|
||||||
echo "Deleting caches..."
|
echo "Deleting caches..."
|
||||||
for cacheKey in $cacheKeysForPR
|
for cacheKey in $cacheKeysForPR
|
||||||
do
|
do
|
||||||
|
|
Loading…
Add table
Reference in a new issue