Skip to content

tag_protections

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

ReposTagProtections

The repos.tag_protections namespace.

create

create(
    owner: str,
    repo: str,
    *,
    name_pattern: str | None = None,
    whitelist_teams: list[str] | None = None,
    whitelist_usernames: list[str] | None = None,
) -> TagProtection

Create a tag protections for a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
name_pattern str | None
None
whitelist_teams list[str] | None
None
whitelist_usernames list[str] | None
None

Returns:

Type Description
TagProtection

TagProtection.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
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: repoCreateTagProtection

delete

delete(owner: str, repo: str, id: int) -> None

Delete a specific tag protection for the repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of protected tag

required

Returns:

Type Description
None

No content.

Raises:

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

Operation ID: repoDeleteTagProtection

get

get(owner: str, repo: str, id: int) -> TagProtection

Get a specific tag protection for the repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of the tag protect to get

required

Returns:

Type Description
TagProtection

TagProtection.

Raises:

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

Operation ID: repoGetTagProtection

list

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

List tag protections for a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[TagProtection]

TagProtectionList.

Operation ID: repoListTagProtection

update

update(
    owner: str,
    repo: str,
    id: int,
    *,
    name_pattern: str | None = None,
    whitelist_teams: list[str] | None = None,
    whitelist_usernames: list[str] | None = None,
) -> TagProtection

Edit a tag protections for a repository. Only fields that are set will be changed.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of protected tag

required
name_pattern str | None
None
whitelist_teams list[str] | None
None
whitelist_usernames list[str] | None
None

Returns:

Type Description
TagProtection

TagProtection.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
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: repoEditTagProtection

AsyncReposTagProtections

The repos.tag_protections namespace.

create

create(
    owner: str,
    repo: str,
    *,
    name_pattern: str | None = None,
    whitelist_teams: list[str] | None = None,
    whitelist_usernames: list[str] | None = None,
) -> TagProtection

Create a tag protections for a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
name_pattern str | None
None
whitelist_teams list[str] | None
None
whitelist_usernames list[str] | None
None

Returns:

Type Description
TagProtection

TagProtection.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
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: repoCreateTagProtection

delete

delete(owner: str, repo: str, id: int) -> None

Delete a specific tag protection for the repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of protected tag

required

Returns:

Type Description
None

No content.

Raises:

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

Operation ID: repoDeleteTagProtection

get

get(owner: str, repo: str, id: int) -> TagProtection

Get a specific tag protection for the repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of the tag protect to get

required

Returns:

Type Description
TagProtection

TagProtection.

Raises:

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

Operation ID: repoGetTagProtection

list

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

List tag protections for a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[TagProtection]

TagProtectionList.

Operation ID: repoListTagProtection

update

update(
    owner: str,
    repo: str,
    id: int,
    *,
    name_pattern: str | None = None,
    whitelist_teams: list[str] | None = None,
    whitelist_usernames: list[str] | None = None,
) -> TagProtection

Edit a tag protections for a repository. Only fields that are set will be changed.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of protected tag

required
name_pattern str | None
None
whitelist_teams list[str] | None
None
whitelist_usernames list[str] | None
None

Returns:

Type Description
TagProtection

TagProtection.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
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: repoEditTagProtection