Skip to content
Merged
Changes from all commits
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
9 changes: 5 additions & 4 deletions mise-tasks/github/cache/remove-for-pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,23 @@ def remove_cache(entry: CacheEntry) -> None:
def main() -> None:
pr = int(os.environ["usage_pr"]) # noqa: SIM112
print(f"Removing caches for PR {pr}")
seen: set[int] = set()
counter = 0
total_count = 0
while True:
caches = list_caches(pr)
raw = list_caches(pr)
caches = [c for c in raw if c.id not in seen]
if not caches:
print(f"Removed {counter} caches for PR {pr}")
break
Comment thread
nikobockerman marked this conversation as resolved.
total_count += len(caches)
total_str = str(total_count)
if len(caches) == LIMIT:
total_str += "+"
total_str = f"{total_count}+" if len(raw) == LIMIT else str(total_count)

for cache in caches:
counter += 1
print(f"Removing cache: {counter}/{total_str}: {cache.key}")
remove_cache(cache)
seen.add(cache.id)


if __name__ == "__main__":
Expand Down
Loading