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:
Jiahao XU 2023-06-05 22:54:01 +10:00 committed by GitHub
parent 3cf2528273
commit cc87fe062d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -15,14 +15,26 @@ jobs:
- uses: actions/checkout@v3
- name: Cleanup
run: |
set -euxo pipefail
gh extension install actions/gh-actions-cache
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' | (
while IFS='$\n' read -r closed_pr; do
BRANCH="refs/pull/${closed_pr}/merge" ./cleanup-cache.sh
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:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}