fix(ci): handle empty commit lookup responses

This commit is contained in:
Kurt Himebauch committed 2026-11-08 21:13:53 -05:00
1 parent 51407155fc
commit 1355cb3a2b
2 files changed
+8 -1

No files matched your search

+1 -1
View File
@@ -158,7 +158,7 @@ def sync(mode, repo, number, discord, sha="", apk="", release=""):
"allowed_mentions": {"parse": []}, "flags": 4})
return
try:
commit = github(f"repos/{repo}/commits/{sha}")
commit = github(f"repos/{repo}/commits/{sha}") or {}
except RuntimeError:
commit = {}
commit_message = (commit.get("commit") or {}).get("message", "")
+7
View File
@@ -250,6 +250,13 @@ class PrDiscordTest(unittest.TestCase):
self.assertEqual("POST", self.discord.request.call_args.args[0])
self.assertNotIn("Latest commit:", self.discord.request.call_args.args[2]["content"])
def test_empty_commit_response_does_not_block_announcement(self):
self.github.side_effect = lambda path, method="GET", body=None: (
self.pull if "/pulls/" in path else None if "/commits/" in path else self.comment)
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