immich/.github/workflows/cache-cleanup.yml
bo0tzz 68f6111b77
chore: use full action versions in comment (#18260)
* Update pr-label-validation.yml

* Update pr-labeler.yml

* Update prepare-release.yml

* Update preview-label.yaml

* Update sdk.yml

* Update static_analysis.yml

* Update test.yml

* Update weblate-lock.yml

* Update build-mobile.yml

* Update cache-cleanup.yml

* Update cli.yml

* Update codeql-analysis.yml

* Update docker.yml

* Update docs-build.yml

* Update docs-deploy.yml

* Update docs-destroy.yml

* Update fix-format.yml
2025-05-13 13:29:55 -04:00

46 lines
1.1 KiB
YAML

name: Cache Cleanup
on:
pull_request:
types:
- closed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
cleanup:
name: Cleanup
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Cleanup
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REF: ${{ github.ref }}
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
echo "Fetching list of cache keys"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B ${REF} -L 100 | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R "$REPO" -B "${REF}" --confirm
done
echo "Done"