From fcda2f6cbd47d213c33f80adbbb3f92daf7c70eb Mon Sep 17 00:00:00 2001 From: Jvst Me Date: Wed, 14 Jan 2026 18:27:01 +0100 Subject: [PATCH] [Internal]: Handle GitHub API errors in `release_notes.py` This improves the script error message if the GitHub API call is not successful (e.g., if the token is expired). Before: ``` TypeError: string indices must be integers, not 'str' ``` After: ``` Exception: Error getting GitHub releases; status: 401, body: { "message": "Bad credentials", "documentation_url": "https://docs.github.com/rest", "status": "401" } ``` --- scripts/release_notes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/release_notes.py b/scripts/release_notes.py index bcc659c462..ab2da2d210 100644 --- a/scripts/release_notes.py +++ b/scripts/release_notes.py @@ -32,6 +32,9 @@ def get_draft_release_by_tag(tag: str) -> dict: headers={"Authorization": f"token {GITHUB_TOKEN}"}, timeout=10, ) + if not r.ok: + msg = f"Error getting GitHub releases; status: {r.status_code}, body: {r.text}" + raise Exception(msg) for release in r.json(): if release["tag_name"] == tag and release["draft"]: return release