PullRequest

class github.PullRequest.PullRequest

This class represents PullRequests. The reference can be found here https://docs.github.com/en/rest/reference/pulls

additions
Type:integer
assignee
Type:github.NamedUser.NamedUser
assignees
Type:list of github.NamedUser.NamedUser
base
Type:github.PullRequestPart.PullRequestPart
body
Type:string
changed_files
Type:integer
closed_at
Type:datetime
comments
Type:integer
comments_url
Type:string
commits
Type:integer
commits_url
Type:string
created_at
Type:datetime
deletions
Type:integer
diff_url
Type:string
draft
Type:bool
head
Type:github.PullRequestPart.PullRequestPart
html_url
Type:string
id
Type:integer
issue_url
Type:string
labels
Type:list of github.Label.Label
merge_commit_sha
Type:string
mergeable
Type:bool
mergeable_state
Type:string
merged
Type:bool
merged_at
Type:datetime
merged_by
Type:github.NamedUser.NamedUser
milestone
Type:github.Milestone.Milestone
number
Type:integer
patch_url
Type:string
rebaseable
Type:bool
review_comment_url
Type:string
review_comments
Type:integer
review_comments_url
Type:string
state
Type:string
title
Type:string
updated_at
Type:datetime
url
Type:string
user
Type:github.NamedUser.NamedUser
maintainer_can_modify
Type:bool
as_issue()
Calls:GET /repos/{owner}/{repo}/issues/{number}
Return type:github.Issue.Issue
create_comment(body, commit, path, position)
Calls:

POST /repos/{owner}/{repo}/pulls/{number}/comments

Parameters:
Return type:

github.PullRequestComment.PullRequestComment

create_review_comment(body, commit, path, line=NotSet, side=NotSet, start_line=NotSet, start_side=NotSet, in_reply_to=NotSet, subject_type=NotSet, as_suggestion=False)
Calls:

POST /repos/{owner}/{repo}/pulls/{number}/comments

Parameters:
  • body – string
  • commitgithub.Commit.Commit
  • path – string
  • line – integer
  • side – string
  • start_line – integer
  • start_side – string
  • in_reply_to – integer
  • subject_type – string
  • as_suggestion – bool interprets the body as suggested code and modifies it accordingly
Return type:

github.PullRequestComment.PullRequestComment

create_review_comment_reply(comment_id, body)
Calls:

POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies

Parameters:
  • comment_id – int
  • body – string
Return type:

github.PullRequestComment.PullRequestComment

create_issue_comment(body)
Calls:POST /repos/{owner}/{repo}/issues/{number}/comments
Parameters:body – string
Return type:github.IssueComment.IssueComment
create_review(commit=NotSet, body=NotSet, event=NotSet, comments=NotSet)
Calls:

POST /repos/{owner}/{repo}/pulls/{number}/reviews

Parameters:
  • commit – github.Commit.Commit
  • body – string
  • event – string
  • comments – list
Return type:

github.PullRequestReview.PullRequestReview

create_review_request(reviewers=NotSet, team_reviewers=NotSet)
Calls:

POST /repos/{owner}/{repo}/pulls/{number}/requested_reviewers

Parameters:
  • reviewers – list of strings
  • team_reviewers – list of strings
Return type:

None

delete_review_request(reviewers=NotSet, team_reviewers=NotSet)
Calls:

DELETE /repos/{owner}/{repo}/pulls/{number}/requested_reviewers

Parameters:
  • reviewers – list of strings
  • team_reviewers – list of strings
Return type:

None

edit(title=NotSet, body=NotSet, state=NotSet, base=NotSet, maintainer_can_modify=NotSet)
Calls:

PATCH /repos/{owner}/{repo}/pulls/{number}

Parameters:
  • title – string
  • body – string
  • state – string
  • base – string
  • maintainer_can_modify – bool
Return type:

None

get_comment(id)
Calls:GET /repos/{owner}/{repo}/pulls/comments/{number}
Parameters:id – integer
Return type:github.PullRequestComment.PullRequestComment
get_review_comment(id)
Calls:GET /repos/{owner}/{repo}/pulls/comments/{number}
Parameters:id – integer
Return type:github.PullRequestComment.PullRequestComment
get_comments(sort=NotSet, direction=NotSet, since=NotSet)

Warning: this only returns review comments. For normal conversation comments, use get_issue_comments.

Calls:

GET /repos/{owner}/{repo}/pulls/{number}/comments

Parameters:
  • sort – string ‘created’ or ‘updated’
  • direction – string ‘asc’ or ‘desc’
  • since – datetime
Return type:

github.PaginatedList.PaginatedList of github.PullRequestComment.PullRequestComment

get_review_comments(*, sort=NotSet, direction=NotSet, since=NotSet)
Calls:

GET /repos/{owner}/{repo}/pulls/{number}/comments

Parameters:
  • sort – string ‘created’ or ‘updated’
  • direction – string ‘asc’ or ‘desc’
  • since – datetime
Return type:

github.PaginatedList.PaginatedList of github.PullRequestComment.PullRequestComment

get_single_review_comments(id)
Calls:GET /repos/{owner}/{repo}/pulls/{number}/review/{id}/comments
Parameters:id – integer
Return type:github.PaginatedList.PaginatedList of github.PullRequestComment.PullRequestComment
get_commits()
Calls:GET /repos/{owner}/{repo}/pulls/{number}/commits
Return type:github.PaginatedList.PaginatedList of github.Commit.Commit
get_files()
Calls:GET /repos/{owner}/{repo}/pulls/{number}/files
Return type:github.PaginatedList.PaginatedList of github.File.File
get_issue_comment(id)
Calls:GET /repos/{owner}/{repo}/issues/comments/{id}
Parameters:id – integer
Return type:github.IssueComment.IssueComment
get_issue_comments()
Calls:GET /repos/{owner}/{repo}/issues/{number}/comments
Return type:github.PaginatedList.PaginatedList of github.IssueComment.IssueComment
get_issue_events()
Calls:GET /repos/{owner}/{repo}/issues/{issue_number}/events
Return type:github.PaginatedList.PaginatedList of github.IssueEvent.IssueEvent
get_review(id)
Calls:GET /repos/{owner}/{repo}/pulls/{number}/reviews/{id}
Parameters:id – integer
Return type:github.PullRequestReview.PullRequestReview
get_reviews()
Calls:GET /repos/{owner}/{repo}/pulls/{number}/reviews
Return type:github.PaginatedList.PaginatedList of github.PullRequestReview.PullRequestReview
get_review_requests()
Calls:GET /repos/{owner}/{repo}/pulls/{number}/requested_reviewers
Return type:tuple of github.PaginatedList.PaginatedList of github.NamedUser.NamedUser and of github.PaginatedList.PaginatedList of github.Team.Team
get_labels()
Calls:GET /repos/{owner}/{repo}/issues/{number}/labels
Return type:github.PaginatedList.PaginatedList of github.Label.Label
add_to_labels(*labels)
Calls:POST /repos/{owner}/{repo}/issues/{number}/labels
Parameters:labelgithub.Label.Label or string
Return type:None
delete_labels()
Calls:DELETE /repos/{owner}/{repo}/issues/{number}/labels
Return type:None
remove_from_labels(label)
Calls:DELETE /repos/{owner}/{repo}/issues/{number}/labels/{name}
Parameters:labelgithub.Label.Label or string
Return type:None
set_labels(*labels)
Calls:PUT /repos/{owner}/{repo}/issues/{number}/labels
Parameters:labels – list of github.Label.Label or strings
Return type:None
is_merged()
Calls:GET /repos/{owner}/{repo}/pulls/{number}/merge
Return type:bool
merge(commit_message=NotSet, commit_title=NotSet, merge_method=NotSet, sha=NotSet)
Calls:

PUT /repos/{owner}/{repo}/pulls/{number}/merge

Parameters:
  • commit_message – string
  • commit_title – string
  • merge_method – string
  • sha – string
Return type:

github.PullRequestMergeStatus.PullRequestMergeStatus

add_to_assignees(*assignees)
Calls:POST /repos/{owner}/{repo}/issues/{number}/assignees
Parameters:assignees – list of github.NamedUser.NamedUser or string
Return type:None
remove_from_assignees(*assignees)
Calls:DELETE /repos/{owner}/{repo}/issues/{number}/assignees
Parameters:assignees – list of github.NamedUser.NamedUser or string
Return type:None
update_branch(expected_head_sha=NotSet)

:calls PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch :param expected_head_sha: string :rtype: bool