PullRequest¶
-
class
github.PullRequest.
PullRequest
¶ This class represents PullRequests.
The reference can be found here https://docs.github.com/en/rest/reference/pulls
The OpenAPI schema can be found at - /components/schemas/pull-request - /components/schemas/pull-request-minimal - /components/schemas/pull-request-simple
A CompletableGithubObject can be partially initialised (completed=False). Accessing attributes that are not initialized will then trigger a request to complete all attributes.
A partially initialized CompletableGithubObject (completed=False) can be completed via complete(). This requires the url to be given via parameter url or attributes.
With a requester where Requester.is_lazy == True, this CompletableGithubObjects is partially initialized. This requires the url to be given via parameter url or attributes. Any CompletableGithubObject created from this lazy object will be lazy itself if created with parameter url or attributes.
- Parameters
requester – requester
headers – response headers
attributes – attributes to initialize
completed – do not update non-initialized attributes when True
url – url of this instance, overrides attributes[‘url’]
accept – use this accept header when completing this instance
-
as_issue
() → github.Issue.Issue¶
-
create_comment
(body: str, commit: github.Commit.Commit, path: str, position: int) → PullRequestComment¶
-
create_review_comment
(body: str, commit: github.Commit.Commit, path: str, line: Opt[int] = NotSet, side: Opt[str] = NotSet, start_line: Opt[int] = NotSet, start_side: Opt[str] = NotSet, in_reply_to: Opt[int] = NotSet, subject_type: Opt[str] = NotSet, as_suggestion: bool = False) → PullRequestComment¶
-
create_review_comment_reply
(comment_id: int, body: str) → PullRequestComment¶
-
create_issue_comment
(body: str) → IssueComment¶
-
create_review
(commit: Opt[github.Commit.Commit] = NotSet, body: Opt[str] = NotSet, event: Opt[str] = NotSet, comments: Opt[list[ReviewComment]] = NotSet) → PullRequestReview¶
-
create_review_request
(reviewers: Opt[list[str] | str] = NotSet, team_reviewers: Opt[list[str] | str] = NotSet) → None¶
-
delete_review_request
(reviewers: Opt[list[str] | str] = NotSet, team_reviewers: Opt[list[str] | str] = NotSet) → None¶
-
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¶
-
get_comment
(id: int) → PullRequestComment¶
-
get_review_comment
(id: int) → PullRequestComment¶
-
get_comments
(sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, since: Opt[datetime] = NotSet) → PaginatedList[PullRequestComment]¶ Warning: this only returns review comments. For normal conversation comments, use get_issue_comments.
- Calls
- Parameters
sort – string ‘created’ or ‘updated’
direction – string ‘asc’ or ‘desc’
since – datetime
-
get_review_comments
(*, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, since: Opt[datetime] = NotSet) → PaginatedList[PullRequestComment]¶ - Calls
- Parameters
sort – string ‘created’ or ‘updated’
direction – string ‘asc’ or ‘desc’
since – datetime
-
get_single_review_comments
(id: int) → PaginatedList[PullRequestComment]¶
-
get_commits
() → PaginatedList[Commit]¶
-
get_files
() → PaginatedList[File]¶
-
get_issue_comment
(id: int) → IssueComment¶
-
get_issue_comments
() → PaginatedList[IssueComment]¶
-
get_issue_events
() → PaginatedList[IssueEvent]¶
-
get_review
(id: int) → PullRequestReview¶ - Calls
- Parameters
id – integer
- Return type
-
get_reviews
() → PaginatedList[PullRequestReview]¶
-
get_review_requests
() → tuple[PaginatedList[NamedUser], PaginatedList[Team]]¶ - Calls
GET /repos/{owner}/{repo}/pulls/{number}/requested_reviewers
- Return type
tuple of
github.PaginatedList.PaginatedList
ofgithub.NamedUser.NamedUser
and ofgithub.PaginatedList.PaginatedList
ofgithub.Team.Team
-
get_labels
() → PaginatedList[Label]¶
-
add_to_labels
(*labels: github.Label.Label | str) → None¶
-
delete_labels
() → None¶
-
remove_from_labels
(label: github.Label.Label | str) → None¶
-
set_labels
(*labels: github.Label.Label | str) → None¶
-
is_merged
() → bool¶
-
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: Opt[str] = NotSet, commit_title: Opt[str] = NotSet, merge_method: Opt[str] = NotSet, sha: Opt[str] = NotSet, delete_branch: bool = False) → PullRequestMergeStatus¶
-
add_to_assignees
(*assignees: github.NamedUser.NamedUser | str) → None¶
-
remove_from_assignees
(*assignees: github.NamedUser.NamedUser | str) → None¶
-
update_branch
(expected_head_sha: Union[str, github.GithubObject._NotSetType] = NotSet) → bool¶ :calls PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch
-
convert_to_draft
(client_mutation_id: Opt[str] = NotSet) → dict[str, Any]¶ - Calls
POST /graphql to convert pull request to draft
<https://docs.github.com/en/graphql/reference/mutations#convertpullrequesttodraft>
-
mark_ready_for_review
(client_mutation_id: Opt[str] = NotSet) → dict[str, Any]¶ - Calls
POST /graphql to mark pull request ready for review
<https://docs.github.com/en/graphql/reference/mutations#markpullrequestreadyforreview>