Skip to content

Commit

Permalink
Look at ref rather than default branch
Browse files Browse the repository at this point in the history
Since we'll only cleanup when running on the default branch
  • Loading branch information
Henry Mercer committed May 23, 2024
1 parent 087f0b0 commit 4fd6c0d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
7 changes: 1 addition & 6 deletions 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.

9 changes: 1 addition & 8 deletions src/trap-caching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,9 @@ export async function cleanupTrapCaches(language: Language, logger: Logger) {
async function getTrapCachesForLanguage(
language: Language,
): Promise<apiClient.ActionsCacheItem[]> {
const event = actionsUtil.getWorkflowEvent();
const defaultBranch = event?.repository?.default_branch as string | undefined;

if (!defaultBranch) {
throw new Error("Could not determine default branch");
}

const allCaches = await apiClient.listActionsCaches(
CODEQL_TRAP_CACHE_PREFIX,
defaultBranch,
await actionsUtil.getRef(),
);

return allCaches.filter((cache) => {
Expand Down

0 comments on commit 4fd6c0d

Please sign in to comment.