Skip to content

Commit

Permalink
Add ALL_RELEASES.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
iakat committed Dec 12, 2024
1 parent 0666fd8 commit 8e2ece4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion update-releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
def get_releases(repo):
releases = []
url = f"https://api.github.com/repos/{repo}/releases"
headers = {"Authorization": f"token {os.getenv('GITHUB_TOKEN')}"} if os.getenv("GITHUB_TOKEN") else {}
while True:
r = requests.get(url)
r = requests.get(url,headers=headers)
r.raise_for_status()
releases += r.json()
if "next" not in r.links:
Expand All @@ -59,6 +60,7 @@ def get_releases(repo):
releases = get_releases(REPO)
releases_per_day = {}
preferred_releases_per_day = {}
all_releases_per_day = {}

for release in releases:
# Get date
Expand All @@ -83,6 +85,9 @@ def get_releases(repo):
#link = f"https://github.com/{REPO}/releases/download/v{date_with_dots}-{pod_name}/v{date_with_dots}-{pod_name}.tar"
# links should be from release.assets.0.browser_download_url, conctenated by string
links = ",".join([asset["browser_download_url"] for asset in release["assets"]])
if date not in all_releases_per_day:
all_releases_per_day[date] = []
all_releases_per_day[date].append([links])
if date not in preferred_releases_per_day:
preferred_releases_per_day[date] = (links, assets_size)
else:
Expand Down Expand Up @@ -126,3 +131,9 @@ def get_releases(repo):

with open("README.md", "w") as f:
f.write(readme)

with open("ALL-RELEASES.txt", "a") as f:
for date in all_releases_per_day.keys():
for links in all_releases_per_day[date]:
f.write(",".join(links) + "\n")

0 comments on commit 8e2ece4

Please sign in to comment.