Skip to content

Commit 54fa379

Browse files
Update github_rest_api/github.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent e5e9b8c commit 54fa379

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

github_rest_api/github.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,10 @@ def _head_commit_date(self, sha: str) -> str:
810810
).json()
811811
if not isinstance(commits, list) or not commits:
812812
raise ValueError(f"No commits found for SHA {sha}")
813-
return commits[0]["commit"]["committer"]["date"]
813+
try:
814+
return commits[0]["commit"]["committer"]["date"]
815+
except (KeyError, TypeError) as e:
816+
raise ValueError(f"Unexpected commit payload structure for SHA {sha}") from e
814817

815818
def get_branches(self, n: int = 0) -> list[dict[str, Any]]:
816819
"""List branches in this repository."""

0 commit comments

Comments
 (0)