From 98d463a025e307ac370069bfe9a49e7b0a5b8eaf Mon Sep 17 00:00:00 2001 From: Yevhen Bondarenko Date: Sat, 11 Jul 2026 11:48:15 +0200 Subject: Match assets by filename instead of by position --- scripts/list-nightly-builds.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/list-nightly-builds.py b/scripts/list-nightly-builds.py index 5f72a43..b0ebe1a 100755 --- a/scripts/list-nightly-builds.py +++ b/scripts/list-nightly-builds.py @@ -24,16 +24,25 @@ def list_images(repo): # so we don't need to sort them releases = repo.get_releases() for r in releases: - iso = r.assets[1] - sig = r.assets[2] + # Match assets by filename instead of by position: each release has + # exactly one ISO plus its Minisign signature (.minisig), + # alongside other assets (checksums, source archives, etc.) whose + # count varies over time. Index-based access breaks whenever that + # count changes, so look the pair up by name. + assets = {a.name: a for a in r.assets} + + iso = next((a for name, a in assets.items() if name.endswith(".iso")), None) + if iso is None: + continue # no ISO in this release, skip + + sig = assets.get(iso.name + ".minisig") + if sig is None: + continue # ISO without a signature, skip - # Nightly build releases have two assets: - # an ISO and a Minisign signature file - # The signature is always the second asset in the list image = {} image["iso_url"] = iso.browser_download_url image["sig_url"] = sig.browser_download_url - image["title"] = r.title + image["title"] = r.name # r.title is deprecated in PyGithub images.append(image) @@ -57,4 +66,4 @@ if __name__ == '__main__': repo = gh.get_repo(REPO) images = list_images(repo) - print(render_image_list(images)) + print(render_image_list(images)) \ No newline at end of file -- cgit v1.2.3