Repository navigation
[CI] Delete the Actions caches of closed pull requests - #406
Merged
Ewerton Scaboro da Silva (ewertons) merged 2 commits intoOct 10, 2026
Merged
Conversation
A closed pull request's caches serve nothing but count against the 10 GB quota until unused for 7 days. ci-c-yocto saves ~450 MB of sstate per run that built something, so they could evict main's entry. - On close: delete that pull request's caches (same-repository only; a fork's token is read-only). - Nightly and manual sweep: delete the caches of every closed pull request. Covers forks, entries saved after close, and older pull requests. Manual runs can dry-run.
Copilot started reviewing on behalf of
Ewerton Scaboro da Silva (ewertons)
October 10, 2026 06:53
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The on-close job fails whenever the pull request has no caches.
1 open finding
What changed in this PR
Adds automated cleanup of GitHub Actions caches belonging to closed pull requests.
Changes:
- Deletes same-repository PR caches upon closure.
- Adds nightly/manual sweeps with dry-run support.
| File | Description |
|---|---|
.github/workflows/cleanup-pr-caches.yml |
Defines cache cleanup triggers and jobs. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
gh cache list --json returns an empty array with exit status 0 when a ref has no caches, whatever the gh version.
Copilot started reviewing on behalf of
Ewerton Scaboro da Silva (ewertons)
October 10, 2026 07:00
View session
Ewerton Scaboro da Silva (ewertons)
left a comment
Contributor
Author
There was a problem hiding this comment.
Reviewed/Approved
Ewerton Scaboro da Silva (ewertons)
deleted the
chore/cleanup-pr-caches
branch
October 10, 2026 07:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

A closed pull request's caches (
refs/pull/<n>/merge) serve nothing but count against the 10 GB cache quota until unused for 7 days.ci-c-yoctosaves ~450 MB of sstate per run that built something, so they can evictmain's entry, which every pull request restores.New workflow
cleanup-pr-caches:pull_request: closed): deletes that pull request's caches. Same-repository pull requests only; a fork's token is read-only.dry-runinput.pull_request_targetis not used: zizmor rates it high (dangerous-triggers), and the sweep covers forks.Verified locally
lint-workflows: no findings.gh cache delete --all --ref <ref> --succeed-on-no-cacheson a ref without caches exits 0.Not verified: a real deletion. The on-close job first runs when this pull request closes.