Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…utils into ci/caches
  • Loading branch information
Borda committed Sep 15, 2023
2 parents 926eefc + 49a8559 commit bb413b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/find-unused-caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def fetch_all_caches(repository: str, token: str, per_page: int = 100, max_pages
url = f"https://github.com/gitapi/repos/{repository}/actions/caches?page={page + 1}&per_page={per_page}"
headers = {"Authorization": f"token {token}"}
response = requests.get(url, headers=headers, timeout=10).json()
if 'total_count' not in response:
if "total_count" not in response:
raise RuntimeError(response.get("message"))
print(f"fetching page... {page} with {per_page} items of expected {response.get('total_count')}")
caches = response.get("actions_caches", [])
Expand All @@ -47,7 +47,7 @@ def fetch_all_caches(repository: str, token: str, per_page: int = 100, max_pages
created_at = pandas.to_datetime(cache["created_at"])
last_used_at = pandas.to_datetime(cache["last_accessed_at"])
cache["last_used_days"] = current_date - last_used_at
age_used = cache["last_used_days"].round(freq='min')
age_used = cache["last_used_days"].round(freq="min")
size = cache["size_in_bytes"] / (1024 * 1024)
print(
f"- Cache Key: {cache_key} |"
Expand Down

0 comments on commit bb413b8

Please sign in to comment.