Skip already-deleted caches in PR cleanup loop#554
Merged
nikobockerman merged 1 commit intoJun 8, 2026
Merged
Conversation
GitHub's Actions Cache list endpoint is eventually consistent: a cache just deleted in one outer iteration can reappear in the next list call, causing the second `gh cache delete` to 404 and fail the job (as seen in PR #553's Cleanup caches run). Track every ID the script has already removed and filter subsequent list responses against it so each cache is only deleted once.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the GitHub Actions cache cleanup script used for PRs to tolerate eventual consistency in gh cache list, preventing attempts to delete the same cache ID multiple times across iterations.
Changes:
- Track cache IDs already deleted (
seen) and filter subsequentgh cache listresponses to avoid double-deletes. - Adjust the “total” progress string to be based on whether the raw list hit the page limit.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
GitHub's Actions Cache list endpoint is eventually consistent: a cache just deleted in one outer iteration can reappear in the next list call, causing the second
gh cache deleteto 404 and fail the job (as seen in PR #553's Cleanup caches run). Track every ID the script has already removed and filter subsequent list responses against it so each cache is only deleted once.