8000 Automatically clean up old TRAP caches by henrymercer · Pull Request #2306 · github/codeql-action · GitHub
[go: up one dir, main page]

Skip to content

Automatically clean up old TRAP caches #2306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve log message when there's nothing to clean up
  • Loading branch information
henrymercer committed May 23, 2024
commit fdba1f907e4ba1e2c6f94820e0db5544951a35e1
6 changes: 5 additions & 1 deletion lib/trap-caching.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/trap-caching.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/trap-caching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,14 @@ export async function cleanupTrapCaches(
logger.debug(
`Keeping most recent TRAP cache (${JSON.stringify(mostRecentCache)})`,
);

if (cachesToRemove.length === 0) {
logger.info(`No TRAP caches to clean up for ${language}.`);
continue;
}

for (const cache of cachesToRemove) {
logger.debug(`Deleting old TRAP cache (${JSON.stringify(cache)})`);
logger.debug(`Cleaning up TRAP cache (${JSON.stringify(cache)})`);
await apiClient.deleteActionsCache(cache.id);
}
const bytesCleanedUp = cachesToRemove.reduce(
Expand Down
0