mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
cache-prune replaces gate-cache-prune. It starts with the run (the gate is one reusable call, so needs: gate waited for every shard) and runs craft-common-actions' cache-prune action in watch mode: each time the gate's build jobs, web or corpus finish, it deletes the entries their new entries replace (the older rolling crates entry, and lockfile- or manifest-keyed entries nothing used since), and it ends when none of those jobs is queued or running.
38 lines
1.4 KiB
YAML
38 lines
1.4 KiB
YAML
name: Cache prune
|
|
|
|
# A pass of the cache prune after every CI attempt on main. ci.yml's `cache prune` job prunes while
|
|
# a run's jobs save their entries, but "Re-run failed jobs" re-runs only the failed jobs: a re-run
|
|
# build job saves a new entry, and the prune job, which succeeded in the first attempt, does not
|
|
# run again. The entry it replaced would stay until the next main run, and with it the cache would
|
|
# be over its 10 GB budget, where GitHub evicts entries a run still needs. This runs once after
|
|
# every attempt, re-runs and cancelled runs included (craft-common-actions actions/cache-prune).
|
|
on:
|
|
workflow_run:
|
|
workflows: [CI]
|
|
types: [completed]
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
cache-prune:
|
|
name: cache prune
|
|
# A fork's pull request from a branch named main also matches `branches`.
|
|
if: github.event.workflow_run.event != 'pull_request'
|
|
timeout-minutes: 10
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
actions: write
|
|
steps:
|
|
- name: Harden runner
|
|
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
|
with:
|
|
egress-policy: audit
|
|
# A failed pass warns; the next run's prune deletes what it missed.
|
|
- name: Prune replaced cache entries
|
|
uses: storytold/craft-common-actions/actions/cache-prune@main
|
|
continue-on-error: true
|
|
with:
|
|
content-keys: corpus
|