Skip to content

Commit 7951d10

Browse files
同じキャッシュを複数回削除しないようにする (#1271)
* 同じキャッシュを複数回削除しないようにする * README修正 (#1273) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * dist反映 (#1272) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 13e2dbc commit 7951d10

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

dist/clean-cache.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/clean-cache.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@ export async function script(
4343
let actionsGetActionsCacheList: PaginatingEndpoints["GET /repos/{owner}/{repo}/actions/caches"]["response"]["data"]["actions_caches"] =
4444
await getActionsGetActionsCacheList(github, context);
4545
let sumSize = getSumSize(actionsGetActionsCacheList);
46+
const deletedActionCacheKeys: string[] = [];
4647

4748
for (let i = 0; i < 40 && 7 * 1024 * 1024 * 1024 < sumSize; i++) {
4849
const actionCache = actionsGetActionsCacheList.shift();
4950

5051
if (
5152
actionCache === undefined ||
5253
actionCache.key === undefined ||
53-
actionCache.size_in_bytes === undefined
54+
actionCache.size_in_bytes === undefined ||
55+
deletedActionCacheKeys.includes(actionCache.key)
5456
) {
5557
continue;
5658
}
@@ -83,6 +85,7 @@ export async function script(
8385
throw e;
8486
}
8587

88+
deletedActionCacheKeys.push(actionCache.key);
8689
sumSize -= actionCache.size_in_bytes;
8790
}
8891
}

0 commit comments

Comments
 (0)