mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
Code review bodies are optional in some cases. (#1169)
* Code review bodies are optional in some cases. * Add test for approving PRs without body set.
This commit is contained in:
committed by
Steve Kowalik
parent
2df7269a95
commit
b84d9b1928
@@ -422,7 +422,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_review(self, commit=github.GithubObject.NotSet, body=None, event=github.GithubObject.NotSet, comments=github.GithubObject.NotSet):
|
||||
def create_review(self, commit=github.GithubObject.NotSet, body=github.GithubObject.NotSet, event=github.GithubObject.NotSet, comments=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/pulls/:number/reviews <https://developer.github.com/v3/pulls/reviews/>`_
|
||||
:param commit: github.Commit.Commit
|
||||
@@ -432,13 +432,14 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
:rtype: :class:`github.PullRequestReview.PullRequestReview`
|
||||
"""
|
||||
assert commit is github.GithubObject.NotSet or isinstance(commit, github.Commit.Commit), commit
|
||||
assert isinstance(body, str), body
|
||||
assert body is github.GithubObject.NotSet or isinstance(body, str), body
|
||||
assert event is github.GithubObject.NotSet or isinstance(event, str), event
|
||||
assert comments is github.GithubObject.NotSet or isinstance(comments, list), comments
|
||||
post_parameters = dict()
|
||||
if commit is not github.GithubObject.NotSet:
|
||||
post_parameters['commit_id'] = commit.sha
|
||||
post_parameters['body'] = body
|
||||
if body is not github.GithubObject.NotSet:
|
||||
post_parameters['body'] = body
|
||||
post_parameters['event'] = 'COMMENT' if event == github.GithubObject.NotSet else event
|
||||
if comments is github.GithubObject.NotSet:
|
||||
post_parameters['comments'] = []
|
||||
|
||||
Reference in New Issue
Block a user