Skip to main content
Ahora la API de REST tiene control de versiones. Para obtener más información, consulta "Acerca del control de versiones de la API".

Puntos de conexión de la API de REST para etiquetas de repositorio

Usa la API de REST para administrar etiquetas para un repositorio.

Closing down - List tag protection states for a repository

Warning

Closing down notice: This operation is closing down and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead.

This returns the tag protection states of a repository.

This information is only available to repository administrators.

Tokens de acceso específicos para "Closing down - List tag protection states for a repository"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "Administration" repository permissions (read)

Parámetros para "Closing down - List tag protection states for a repository"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
owner string Requerido

The account owner of the repository. The name is not case sensitive.

repo string Requerido

The name of the repository without the .git extension. The name is not case sensitive.

Códigos de estado de respuesta HTTP para "Closing down - List tag protection states for a repository"

status codeDescripción
200

OK

403

Forbidden

404

Resource not found

Ejemplos de código para "Closing down - List tag protection states for a repository"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/repos/{owner}/{repo}/tags/protection
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/tags/protection

Response

Status: 200
[ { "id": 2, "pattern": "v1.*" } ]

Closing down - Create a tag protection state for a repository

Warning

Closing down notice: This operation is closing down and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead.

This creates a tag protection state for a repository. This endpoint is only available to repository administrators.

Tokens de acceso específicos para "Closing down - Create a tag protection state for a repository"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "Administration" repository permissions (write)

Parámetros para "Closing down - Create a tag protection state for a repository"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
owner string Requerido

The account owner of the repository. The name is not case sensitive.

repo string Requerido

The name of the repository without the .git extension. The name is not case sensitive.

Parámetros del cuerpo
Nombre, Tipo, Descripción
pattern string Requerido

An optional glob pattern to match against when enforcing tag protection.

Códigos de estado de respuesta HTTP para "Closing down - Create a tag protection state for a repository"

status codeDescripción
201

Created

403

Forbidden

404

Resource not found

Ejemplos de código para "Closing down - Create a tag protection state for a repository"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

post/repos/{owner}/{repo}/tags/protection
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/tags/protection \ -d '{"pattern":"v1.*"}'

Response

Status: 201
{ "enabled": true }

Closing down - Delete a tag protection state for a repository

Warning

Closing down notice: This operation is closing down and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead.

This deletes a tag protection state for a repository. This endpoint is only available to repository administrators.

Tokens de acceso específicos para "Closing down - Delete a tag protection state for a repository"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "Administration" repository permissions (write)

Parámetros para "Closing down - Delete a tag protection state for a repository"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
owner string Requerido

The account owner of the repository. The name is not case sensitive.

repo string Requerido

The name of the repository without the .git extension. The name is not case sensitive.

tag_protection_id integer Requerido

The unique identifier of the tag protection.

Códigos de estado de respuesta HTTP para "Closing down - Delete a tag protection state for a repository"

status codeDescripción
204

No Content

403

Forbidden

404

Resource not found

Ejemplos de código para "Closing down - Delete a tag protection state for a repository"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

delete/repos/{owner}/{repo}/tags/protection/{tag_protection_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/tags/protection/TAG_PROTECTION_ID

Response

Status: 204