Clear caches older than 5 days (#8494)

This commit is contained in:
Bjorn Lu 2023-09-11 20:05:17 +08:00 committed by GitHub
parent 0ca332ba4a
commit 1ed21d10db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,19 +1,28 @@
name: Cleanup cache
on:
schedule:
- cron: "0 11 * * *"
pull_request:
types:
- closed
# Workflow copied from https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Cleanup
- name: Cleanup caches older than 5 days
if: github.event_name == 'schedule'
uses: MyAlbum/purge-cache@v2
with:
max-age: 432000
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
- name: Cleanup on PR close
if: github.event_name == 'pull_request'
run: |
gh extension install actions/gh-actions-cache