ghapi.reviews#

class ghapi.reviews.Comment(path: str, body: str, line: int, **kwargs: Any)[source]#

Implements a comment object

Parameters
  • path – the relative path to the file that necessitates a comment.

  • body – the text of the review comment.

  • line – the line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.

  • kwargs – keyword arguments for comment (cf. Review creation)

class ghapi.reviews.Review(pr: PullRequest, review_id: int, conn: Optional[Connection] = None)[source]#

Implements a Review object

>>> from ghapi import Repository, PullRequest, Review
>>> pr = PullRequest(Repository("frgfm", "Holocron"), 260)
>>> review = Review(pr, 1212580495)
>>> review.get_info()
Parameters
  • pr – a pull request object

  • review_id – the review identifier

  • conn – connection object

classmethod from_comments(pr: PullRequest, body: str, comments: List[Comment], action: ReviewAction = ReviewAction.COMMENT, conn: Optional[Connection] = None) T[source]#

Submit a review from comments

>>> from ghapi import Repository, PullRequest, Review, Comment
>>> pr = PullRequest(Repository("owner-login", "awesome-repo"), 1)
>>> pr.conn.set_token("MY_DUMMY_TOKEN")
>>> comment = Comment("README.md", "This is weird!", 9)
>>> review = Review.from_comments(pr, "Thanks for the PR :pray:", [comment])
Parameters
  • pr – a pull request object

  • body – the body text of the pull request review.

  • comments – the review comments

  • action – the review action you want to perform.

  • conn – connection object

get_info() Dict[str, Any][source]#

Parses high-level information from the review payload

list_comments(**kwargs: Any) List[Dict[str, Any]][source]#

List the comments of a Pull Request Review.

Parameters

kwargs – query parameters of List review comments

Returns

list of comments