8000 Merge pull request #944 from pabelanger/temp/missing-commit-id · smendes/github3.py@473312a · GitHub
[go: up one dir, main page]

Skip to content

Commit 473312a

Browse files
authored
Merge pull request sigmavirus24#944 from pabelanger/temp/missing-commit-id
Don't expect commit_id for PullReview
2 parents db1f7e7 + 2ce81e7 commit 473312a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/github3/pulls.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,12 @@ class PullReview(models.GitHubCore):
926926
927927
The SHA of the commit that the review was left on.
928928
929+
.. note::
930+
931+
It is possible for the attribute to be set to ``None``, if the
932+
review references a commit that is no longer available in the pull
933+
request branch, such as after a force push.
934+
929935
.. attribute:: html_url
930936
931937
.. versionadded:: 1.0.0
@@ -958,7 +964,9 @@ def _update_attributes(self, review):
958964
self.body = review["body"]
959965
self.body_html = review["body_html"]
960966
self.body_text = review["body_text"]
961-
self.commit_id = review["commit_id"]
967+
# NOTE(pabelanger): In some cases, commit_id could be missing on a
968+
# PullReview.
969+
self.commit_id = review.get("commit_id", None)
962970
self.html_url = review["html_url"]
963971
self.user = users.ShortUser(review["user"], self)
964972
self.state = review["state"]

0 commit comments

Comments
 (0)
0