From 51407155fc00c3a67c63ef059969d571f67fad62 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Sun, 8 Nov 2026 21:12:58 -0500 Subject: [PATCH] fix(ci): keep commit lookup failures from blocking notices --- tools/release/pr_discord.py | 7 +++++-- tools/tests/test_pr_discord.py | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/release/pr_discord.py b/tools/release/pr_discord.py index c0ca0b961..84fe0265b 100644 --- a/tools/release/pr_discord.py +++ b/tools/release/pr_discord.py @@ -157,8 +157,11 @@ def sync(mode, repo, number, discord, sha="", apk="", release=""): {"content": retired_content(message["content"], pull.get("merged", False)), "allowed_mentions": {"parse": []}, "flags": 4}) return - commit = github(f"repos/{repo}/commits/{sha}") - commit_message = commit.get("commit", {}).get("message", "") + try: + commit = github(f"repos/{repo}/commits/{sha}") + except RuntimeError: + commit = {} + commit_message = (commit.get("commit") or {}).get("message", "") content = build_content(repo, number, pull["title"], sha, apk, release, pull.get("body"), commit_message) if len(content) > 1800: raise RuntimeError("Discord announcement is too long") diff --git a/tools/tests/test_pr_discord.py b/tools/tests/test_pr_discord.py index 5c901f6bd..2a1394d3b 100644 --- a/tools/tests/test_pr_discord.py +++ b/tools/tests/test_pr_discord.py @@ -240,6 +240,16 @@ class PrDiscordTest(unittest.TestCase): self.assertIn(r"Latest commit: Fix \*input\* @everyone", content) self.assertNotIn("Details", content) + def test_commit_lookup_failure_does_not_block_announcement(self): + def unavailable_commit(path, method="GET", body=None): + if "/commits/" in path: + raise RuntimeError("GitHub request failed") + return self.pull if "/pulls/" in path else self.comment + self.github.side_effect = unavailable_commit + self.publish() + self.assertEqual("POST", self.discord.request.call_args.args[0]) + self.assertNotIn("Latest commit:", self.discord.request.call_args.args[2]["content"]) + original_report = module.report_comment