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 parameterurlorattributes.With a requester where
Requester.is_lazy == True, this CompletableGithubObjects is partially initialized. This requires the url to be given via parameterurlorattributes. Any CompletableGithubObject created from this lazy object will be lazy itself if created with parameterurlorattributes.- 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
- create_comment(body: str, commit: github.Commit.Commit, path: str, position: int) PullRequestComment
- create_review_comment(body: str, commit: github.Commit.Commit | str, 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: list[str] | str | _NotSetType = NotSet, team_reviewers: list[str] | str | _NotSetType = NotSet) None
- delete_review_request(reviewers: list[str] | str | _NotSetType = NotSet, team_reviewers: list[str] | str | _NotSetType = NotSet) None
- edit(title: str | _NotSetType = NotSet, body: str | _NotSetType = NotSet, state: str | _NotSetType = NotSet, base: str | _NotSetType = NotSet, maintainer_can_modify: bool | _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_issue_timeline() PaginatedList[TimelineEvent]
:calls GET /repos/{owner}/{repo}/issues/{issue_number}/timeline :rtype:
github.PaginatedList.PaginatedListofgithub.TimelineEvent
- get_review(id: int) PullRequestReview
- Calls:
GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}
- Parameters:
id – integer
- Return type:
- get_reviews() PaginatedList[PullRequestReview]
- get_review_requests() tuple[PaginatedList[NamedUser], PaginatedList[Team]]
- Calls:
GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers
- Return type:
tuple of
github.PaginatedList.PaginatedListofgithub.NamedUser.NamedUserand ofgithub.PaginatedList.PaginatedListofgithub.Team.Team
- get_labels() PaginatedList[Label]
- delete_labels() 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: str | _NotSetType = 'MERGE', author_email: str | _NotSetType = NotSet, client_mutation_id: str | _NotSetType = NotSet, commit_body: str | _NotSetType = NotSet, commit_headline: str | _NotSetType = NotSet, expected_head_oid: str | _NotSetType = 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: str | _NotSetType = 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
- update_branch(expected_head_sha: str | _NotSetType = NotSet) bool
:calls PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch
- convert_to_draft(client_mutation_id: str | _NotSetType = 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: str | _NotSetType = NotSet) dict[str, Any]
- Calls:
POST /graphql to mark pull request ready for review <https://docs.github.com/en/graphql/reference/mutations#markpullrequestreadyforreview>