Problem
Actions caches created for a pull request are never deleted when that pull request closes. On 2026-08-19 this repository held 15 caches of about 209 MB each, roughly 3.1 GB. Every one of them belonged to a pull request that was already merged or closed, and all 15 shared the same cache key. Each repository on the Free plan gets 10 GB of cache. Filling it wastes the allowance and produces billing alert emails for the organisation.
Outcome
When a pull request closes, the caches that belong only to that pull request are deleted automatically. No manual cleanup is needed.
Acceptance criteria
Notes
- The 15 caches were deleted by hand on 2026-08-19.
- Because all 15 shared one cache key, each pull request stored a full copy of the same content. Worth checking whether the cache key needs to include the pull request ref at all.
- List caches with
GET /repos/{owner}/{repo}/actions/caches, delete with DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}.
Problem
Actions caches created for a pull request are never deleted when that pull request closes. On 2026-08-19 this repository held 15 caches of about 209 MB each, roughly 3.1 GB. Every one of them belonged to a pull request that was already merged or closed, and all 15 shared the same cache key. Each repository on the Free plan gets 10 GB of cache. Filling it wastes the allowance and produces billing alert emails for the organisation.
Outcome
When a pull request closes, the caches that belong only to that pull request are deleted automatically. No manual cleanup is needed.
Acceptance criteria
pull_requestwithtypes: [closed].refisrefs/pull/<number>/mergefor the pull request that just closed.GITHUB_TOKENwithpermissions: actions: write, not a personal access token.refs/heads/mainandrefs/heads/developare not touched.Notes
GET /repos/{owner}/{repo}/actions/caches, delete withDELETE /repos/{owner}/{repo}/actions/caches/{cache_id}.