Skip to content

pulls

Accessed as client.repos.pulls; the async client mirrors it.

ReposPulls

The repos.pulls namespace.

requested_reviewers

reviews

cancel_auto_merge

cancel_auto_merge(owner: str, repo: str, index: int) -> None

Cancel the scheduled auto merge for the given pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to merge

required

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
LockedError
  1. APIRepoArchivedError is an error that is raised when an archived repo should be modified.

Operation ID: repoCancelScheduledAutoMerge

commits

commits(
    owner: str,
    repo: str,
    index: int,
    *,
    verification: bool | None = None,
    files: bool | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> Paginated[Commit]

Get commits for a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required
verification bool | None

include verification for every commit (disable for speedup, default 'true')

None
files bool | None

include a list of affected files for every commit (disable for speedup, default 'true')

None
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
Paginated[Commit]

CommitList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetPullRequestCommits

create

create(
    owner: str,
    repo: str,
    *,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    base: str | None = None,
    body: str | None = None,
    due_date: datetime | None = None,
    head: str | None = None,
    labels: list[int] | None = None,
    milestone: int | None = None,
    title: str | None = None,
) -> PullRequest

Create a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
assignee str | None
None
assignees list[str] | None
None
base str | None
None
body str | None
None
due_date datetime | None
None
head str | None
None
labels list[int] | None
None
milestone int | None
None
title str | None
None

Returns:

Type Description
PullRequest

PullRequest.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
ConflictError
  1. APIError is error format response.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.
LockedError
  1. APIRepoArchivedError is an error that is raised when an archived repo should be modified.

Operation ID: repoCreatePullRequest

download

download(owner: str, repo: str, index: int, diff_type: Literal['diff', 'patch'], *, binary: bool | None = None) -> str

Get a pull request diff or patch.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required
diff_type Literal['diff', 'patch']

whether the output is diff or patch

required
binary bool | None

whether to include binary file changes. if true, the diff is applicable with git apply

None

Returns:

Type Description
str

APIString is a string response.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoDownloadPullDiffOrPatch

files

files(
    owner: str,
    repo: str,
    index: int,
    *,
    skip_to: str | None = None,
    whitespace: Literal["ignore-all", "ignore-change", "ignore-eol", "show-all"] | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> Paginated[ChangedFile]

Get changed files for a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required
skip_to str | None

skip to given file

None
whitespace Literal['ignore-all', 'ignore-change', 'ignore-eol', 'show-all'] | None

whitespace behavior

None
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
Paginated[ChangedFile]

ChangedFileListWithPagination.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetPullRequestFiles

get

get(owner: str, repo: str, index: int) -> PullRequest

Get a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required

Returns:

Type Description
PullRequest

PullRequest.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetPullRequest

get_by_base_head

get_by_base_head(owner: str, repo: str, base: str, head: str) -> PullRequest

Get a pull request by base and head.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
base str

base of the pull request to get

required
head str

head of the pull request to get

required

Returns:

Type Description
PullRequest

PullRequest.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetPullRequestByBaseHead

is_merged

is_merged(owner: str, repo: str, index: int) -> None

Check if a pull request has been merged.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request

required

Returns:

Type Description
None

No content.

Raises:

Type Description
NotFoundError
  1. pull request has not been merged.

Operation ID: repoPullRequestIsMerged

list

list(
    owner: str,
    repo: str,
    *,
    state: Literal["open", "closed", "all"] | None = None,
    sort: Literal["oldest", "recentupdate", "recentclose", "leastupdate", "mostcomment", "leastcomment", "priority"]
    | None = None,
    milestone: int | None = None,
    labels: list[int] | None = None,
    poster: str | None = None,
    base: str | None = None,
    head: str | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> Paginated[PullRequest]

List a repo's pull requests. If a pull request is selected but fails to be retrieved for any reason, it will be a null value in the list of results.

Parameters:

Name Type Description Default
owner str

Owner of the repo

required
repo str

Name of the repo

required
state Literal['open', 'closed', 'all'] | None

State of pull request

None
sort Literal['oldest', 'recentupdate', 'recentclose', 'leastupdate', 'mostcomment', 'leastcomment', 'priority'] | None

Type of sort

None
milestone int | None

ID of the milestone

None
labels list[int] | None

Label IDs

None
poster str | None

Filter by pull request author

None
base str | None

Filter by base branch name

None
head str | None

Filter by head branch name

None
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
Paginated[PullRequest]

PullRequestList.

Raises:

Type Description
BadRequestError
  1. APIError is error format response.
NotFoundError
  1. APINotFound is a not found error response.
ServerError
  1. APIError is error format response.

Operation ID: repoListPullRequests

merge

merge(
    owner: str,
    repo: str,
    index: int,
    *,
    do: MergePullRequestOptionDo,
    merge_commit_id: str | None = None,
    merge_message_field: str | None = None,
    merge_title_field: str | None = None,
    delete_branch_after_merge: bool | None = None,
    force_merge: bool | None = None,
    head_commit_id: str | None = None,
    merge_when_checks_succeed: bool | None = None,
) -> None

Merge a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to merge

required
do MergePullRequestOptionDo
required
merge_commit_id str | None
None
merge_message_field str | None
None
merge_title_field str | None
None
delete_branch_after_merge bool | None
None
force_merge bool | None
None
head_commit_id str | None
None
merge_when_checks_succeed bool | None
None

Returns:

Type Description
None

No content.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
MethodNotAllowedError
  1. APIEmpty is an empty response.
ConflictError
  1. APIError is error format response.
PayloadTooLargeError
  1. QuotaExceeded.
LockedError
  1. APIRepoArchivedError is an error that is raised when an archived repo should be modified.

Operation ID: repoMergePullRequest

pinned

pinned(owner: str, repo: str) -> list[PullRequest]

List a repo's pinned pull requests.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[PullRequest]

PullRequestList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListPinnedPullRequests

update

update(
    owner: str,
    repo: str,
    index: int,
    *,
    allow_maintainer_edit: bool | None = None,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    base: str | None = None,
    body: str | None = None,
    due_date: datetime | None = None,
    labels: list[int] | None = None,
    milestone: int | None = None,
    state: str | None = None,
    title: str | None = None,
    unset_due_date: bool | None = None,
) -> PullRequest

Update a pull request. If using deadline only the date will be taken into account, and time of day ignored.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to edit

required
allow_maintainer_edit bool | None
None
assignee str | None
None
assignees list[str] | None
None
base str | None
None
body str | None
None
due_date datetime | None
None
labels list[int] | None
None
milestone int | None
None
state str | None
None
title str | None
None
unset_due_date bool | None
None

Returns:

Type Description
PullRequest

PullRequest.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
ConflictError
  1. APIError is error format response.
PreconditionFailedError
  1. APIError is error format response.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoEditPullRequest

update_branch

update_branch(owner: str, repo: str, index: int, *, style: Literal['merge', 'rebase'] | None = None) -> None

Merge PR's baseBranch into headBranch.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required
style Literal['merge', 'rebase'] | None

how to update pull request

None

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
ConflictError
  1. APIError is error format response.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoUpdatePullRequest

AsyncReposPulls

The repos.pulls namespace.

requested_reviewers

reviews

cancel_auto_merge

cancel_auto_merge(owner: str, repo: str, index: int) -> None

Cancel the scheduled auto merge for the given pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to merge

required

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
LockedError
  1. APIRepoArchivedError is an error that is raised when an archived repo should be modified.

Operation ID: repoCancelScheduledAutoMerge

commits

commits(
    owner: str,
    repo: str,
    index: int,
    *,
    verification: bool | None = None,
    files: bool | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> AsyncPaginated[Commit]

Get commits for a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required
verification bool | None

include verification for every commit (disable for speedup, default 'true')

None
files bool | None

include a list of affected files for every commit (disable for speedup, default 'true')

None
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
AsyncPaginated[Commit]

CommitList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetPullRequestCommits

create

create(
    owner: str,
    repo: str,
    *,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    base: str | None = None,
    body: str | None = None,
    due_date: datetime | None = None,
    head: str | None = None,
    labels: list[int] | None = None,
    milestone: int | None = None,
    title: str | None = None,
) -> PullRequest

Create a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
assignee str | None
None
assignees list[str] | None
None
base str | None
None
body str | None
None
due_date datetime | None
None
head str | None
None
labels list[int] | None
None
milestone int | None
None
title str | None
None

Returns:

Type Description
PullRequest

PullRequest.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
ConflictError
  1. APIError is error format response.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.
LockedError
  1. APIRepoArchivedError is an error that is raised when an archived repo should be modified.

Operation ID: repoCreatePullRequest

download

download(owner: str, repo: str, index: int, diff_type: Literal['diff', 'patch'], *, binary: bool | None = None) -> str

Get a pull request diff or patch.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required
diff_type Literal['diff', 'patch']

whether the output is diff or patch

required
binary bool | None

whether to include binary file changes. if true, the diff is applicable with git apply

None

Returns:

Type Description
str

APIString is a string response.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoDownloadPullDiffOrPatch

files

files(
    owner: str,
    repo: str,
    index: int,
    *,
    skip_to: str | None = None,
    whitespace: Literal["ignore-all", "ignore-change", "ignore-eol", "show-all"] | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> AsyncPaginated[ChangedFile]

Get changed files for a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required
skip_to str | None

skip to given file

None
whitespace Literal['ignore-all', 'ignore-change', 'ignore-eol', 'show-all'] | None

whitespace behavior

None
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
AsyncPaginated[ChangedFile]

ChangedFileListWithPagination.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetPullRequestFiles

get

get(owner: str, repo: str, index: int) -> PullRequest

Get a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required

Returns:

Type Description
PullRequest

PullRequest.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetPullRequest

get_by_base_head

get_by_base_head(owner: str, repo: str, base: str, head: str) -> PullRequest

Get a pull request by base and head.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
base str

base of the pull request to get

required
head str

head of the pull request to get

required

Returns:

Type Description
PullRequest

PullRequest.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetPullRequestByBaseHead

is_merged

is_merged(owner: str, repo: str, index: int) -> None

Check if a pull request has been merged.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request

required

Returns:

Type Description
None

No content.

Raises:

Type Description
NotFoundError
  1. pull request has not been merged.

Operation ID: repoPullRequestIsMerged

list

list(
    owner: str,
    repo: str,
    *,
    state: Literal["open", "closed", "all"] | None = None,
    sort: Literal["oldest", "recentupdate", "recentclose", "leastupdate", "mostcomment", "leastcomment", "priority"]
    | None = None,
    milestone: int | None = None,
    labels: list[int] | None = None,
    poster: str | None = None,
    base: str | None = None,
    head: str | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> AsyncPaginated[PullRequest]

List a repo's pull requests. If a pull request is selected but fails to be retrieved for any reason, it will be a null value in the list of results.

Parameters:

Name Type Description Default
owner str

Owner of the repo

required
repo str

Name of the repo

required
state Literal['open', 'closed', 'all'] | None

State of pull request

None
sort Literal['oldest', 'recentupdate', 'recentclose', 'leastupdate', 'mostcomment', 'leastcomment', 'priority'] | None

Type of sort

None
milestone int | None

ID of the milestone

None
labels list[int] | None

Label IDs

None
poster str | None

Filter by pull request author

None
base str | None

Filter by base branch name

None
head str | None

Filter by head branch name

None
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
AsyncPaginated[PullRequest]

PullRequestList.

Raises:

Type Description
BadRequestError
  1. APIError is error format response.
NotFoundError
  1. APINotFound is a not found error response.
ServerError
  1. APIError is error format response.

Operation ID: repoListPullRequests

merge

merge(
    owner: str,
    repo: str,
    index: int,
    *,
    do: MergePullRequestOptionDo,
    merge_commit_id: str | None = None,
    merge_message_field: str | None = None,
    merge_title_field: str | None = None,
    delete_branch_after_merge: bool | None = None,
    force_merge: bool | None = None,
    head_commit_id: str | None = None,
    merge_when_checks_succeed: bool | None = None,
) -> None

Merge a pull request.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to merge

required
do MergePullRequestOptionDo
required
merge_commit_id str | None
None
merge_message_field str | None
None
merge_title_field str | None
None
delete_branch_after_merge bool | None
None
force_merge bool | None
None
head_commit_id str | None
None
merge_when_checks_succeed bool | None
None

Returns:

Type Description
None

No content.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
MethodNotAllowedError
  1. APIEmpty is an empty response.
ConflictError
  1. APIError is error format response.
PayloadTooLargeError
  1. QuotaExceeded.
LockedError
  1. APIRepoArchivedError is an error that is raised when an archived repo should be modified.

Operation ID: repoMergePullRequest

pinned

pinned(owner: str, repo: str) -> list[PullRequest]

List a repo's pinned pull requests.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[PullRequest]

PullRequestList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListPinnedPullRequests

update

update(
    owner: str,
    repo: str,
    index: int,
    *,
    allow_maintainer_edit: bool | None = None,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    base: str | None = None,
    body: str | None = None,
    due_date: datetime | None = None,
    labels: list[int] | None = None,
    milestone: int | None = None,
    state: str | None = None,
    title: str | None = None,
    unset_due_date: bool | None = None,
) -> PullRequest

Update a pull request. If using deadline only the date will be taken into account, and time of day ignored.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to edit

required
allow_maintainer_edit bool | None
None
assignee str | None
None
assignees list[str] | None
None
base str | None
None
body str | None
None
due_date datetime | None
None
labels list[int] | None
None
milestone int | None
None
state str | None
None
title str | None
None
unset_due_date bool | None
None

Returns:

Type Description
PullRequest

PullRequest.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
ConflictError
  1. APIError is error format response.
PreconditionFailedError
  1. APIError is error format response.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoEditPullRequest

update_branch

update_branch(owner: str, repo: str, index: int, *, style: Literal['merge', 'rebase'] | None = None) -> None

Merge PR's baseBranch into headBranch.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
index int

index of the pull request to get

required
style Literal['merge', 'rebase'] | None

how to update pull request

None

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
ConflictError
  1. APIError is error format response.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoUpdatePullRequest