PullRequest

class github.PullRequest.PullRequest

This class represents PullRequests.

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

as_issue() → github.Issue.Issue
Calls

GET /repos/{owner}/{repo}/issues/{number}

create_comment(body: str, commit: github.Commit.Commit, path: str, position: int) → github.PullRequestComment.PullRequestComment
Calls

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

create_review_comment(body: str, commit: github.Commit.Commit, path: str, line: Union[int, github.GithubObject._NotSetType] = NotSet, side: Union[str, github.GithubObject._NotSetType] = NotSet, start_line: Union[int, github.GithubObject._NotSetType] = NotSet, start_side: Union[int, github.GithubObject._NotSetType] = NotSet, in_reply_to: Union[int, github.GithubObject._NotSetType] = NotSet, subject_type: Union[str, github.GithubObject._NotSetType] = NotSet, as_suggestion: bool = False) → github.PullRequestComment.PullRequestComment
Calls

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

create_review_comment_reply(comment_id: int, body: str) → github.PullRequestComment.PullRequestComment
Calls

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

create_issue_comment(body: str) → github.IssueComment.IssueComment
Calls

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

create_review(commit: Opt[github.Commit.Commit] = NotSet, body: Opt[str] = NotSet, event: Opt[str] = NotSet, comments: Opt[list[ReviewComment]] = NotSet) → github.PullRequestReview.PullRequestReview
Calls

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

create_review_request(reviewers: Opt[list[str] | str] = NotSet, team_reviewers: Opt[list[str] | str] = NotSet) → None
Calls

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

delete_review_request(reviewers: Opt[list[str] | str] = NotSet, team_reviewers: Opt[list[str] | str] = NotSet) → None
Calls

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

edit(title: Union[str, github.GithubObject._NotSetType] = NotSet, body: Union[str, github.GithubObject._NotSetType] = NotSet, state: Union[str, github.GithubObject._NotSetType] = NotSet, base: Union[str, github.GithubObject._NotSetType] = NotSet, maintainer_can_modify: Union[bool, github.GithubObject._NotSetType] = NotSet) → None
Calls

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

get_comment(id: int) → github.PullRequestComment.PullRequestComment
Calls

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

get_review_comment(id: int) → github.PullRequestComment.PullRequestComment
Calls

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

get_comments(sort: Union[str, github.GithubObject._NotSetType] = NotSet, direction: Union[str, github.GithubObject._NotSetType] = NotSet, since: Union[datetime.datetime, github.GithubObject._NotSetType] = NotSet) → github.PaginatedList.PaginatedList[github.PullRequestComment.PullRequestComment][github.PullRequestComment.PullRequestComment]

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

get_review_comments(*, sort: Union[str, github.GithubObject._NotSetType] = NotSet, direction: Union[str, github.GithubObject._NotSetType] = NotSet, since: Union[datetime.datetime, github.GithubObject._NotSetType] = NotSet) → github.PaginatedList.PaginatedList[github.PullRequestComment.PullRequestComment][github.PullRequestComment.PullRequestComment]
Calls

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

Parameters
  • sort – string ‘created’ or ‘updated’

  • direction – string ‘asc’ or ‘desc’

  • since – datetime

get_single_review_comments(id: int) → github.PaginatedList.PaginatedList[github.PullRequestComment.PullRequestComment][github.PullRequestComment.PullRequestComment]
Calls

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

get_commits() → github.PaginatedList.PaginatedList[github.Commit.Commit][github.Commit.Commit]
Calls

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

get_files() → github.PaginatedList.PaginatedList[github.File.File][github.File.File]
Calls

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

get_issue_comment(id: int) → github.IssueComment.IssueComment
Calls

GET /repos/{owner}/{repo}/issues/comments/{id}

get_issue_comments() → github.PaginatedList.PaginatedList[github.IssueComment.IssueComment][github.IssueComment.IssueComment]
Calls

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

get_issue_events() → github.PaginatedList.PaginatedList[github.IssueEvent.IssueEvent][github.IssueEvent.IssueEvent]
Calls

GET /repos/{owner}/{repo}/issues/{issue_number}/events

Return type

github.PaginatedList.PaginatedList of github.IssueEvent.IssueEvent

get_review(id: int) → github.PullRequestReview.PullRequestReview
Calls

GET /repos/{owner}/{repo}/pulls/{number}/reviews/{id}

Parameters

id – integer

Return type

github.PullRequestReview.PullRequestReview

get_reviews() → github.PaginatedList.PaginatedList[github.PullRequestReview.PullRequestReview][github.PullRequestReview.PullRequestReview]
Calls

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

Return type

github.PaginatedList.PaginatedList of github.PullRequestReview.PullRequestReview

get_review_requests() → tuple[PaginatedList[NamedUser], PaginatedList[github.Team.Team]]
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() → github.PaginatedList.PaginatedList[github.Label.Label][github.Label.Label]
Calls

GET /repos/{owner}/{repo}/issues/{number}/labels

add_to_labels(*labels: github.Label.Label | str) → None
Calls

POST /repos/{owner}/{repo}/issues/{number}/labels

delete_labels() → None
Calls

DELETE /repos/{owner}/{repo}/issues/{number}/labels

remove_from_labels(label: github.Label.Label | str) → None
Calls

DELETE /repos/{owner}/{repo}/issues/{number}/labels/{name}

set_labels(*labels: github.Label.Label | str) → None
Calls

PUT /repos/{owner}/{repo}/issues/{number}/labels

is_merged() → bool
Calls

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

restore_branch() → GitRef

Convenience function that calls Repository.create_git_ref() :rtype: github.GitRef.GitRef

delete_branch(force: bool = False) → None

Convenience function that calls GitRef.delete() :rtype: bool.

enable_automerge(merge_method: Opt[str] = 'MERGE', author_email: Opt[str] = NotSet, client_mutation_id: Opt[str] = NotSet, commit_body: Opt[str] = NotSet, commit_headline: Opt[str] = NotSet, expected_head_oid: Opt[str] = NotSet) → dict[str, Any]
Calls

POST /graphql with a mutation to enable pull request auto merge

<https://docs.github.com/en/graphql/reference/mutations#enablepullrequestautomerge>

disable_automerge(client_mutation_id: Opt[str] = NotSet) → dict[str, Any]
Calls

POST /graphql with a mutation to disable pull request auto merge

<https://docs.github.com/en/graphql/reference/mutations#disablepullrequestautomerge>

merge(commit_message: Union[str, github.GithubObject._NotSetType] = NotSet, commit_title: Union[str, github.GithubObject._NotSetType] = NotSet, merge_method: Union[str, github.GithubObject._NotSetType] = NotSet, sha: Union[str, github.GithubObject._NotSetType] = NotSet, delete_branch: bool = False) → github.PullRequestMergeStatus.PullRequestMergeStatus
Calls

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

add_to_assignees(*assignees: github.NamedUser.NamedUser | str) → None
Calls

POST /repos/{owner}/{repo}/issues/{number}/assignees

remove_from_assignees(*assignees: github.NamedUser.NamedUser | str) → None
Calls

DELETE /repos/{owner}/{repo}/issues/{number}/assignees

update_branch(expected_head_sha: Union[str, github.GithubObject._NotSetType] = NotSet) → bool

:calls PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch