Skip to main content

Enterprise Server 3.20 actualmente está disponible como versión candidata para lanzamiento.

Ahora la API REST está versionada. 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.

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 ruta
Nombre, Tipo, Descripción
owner string Obligatorio

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

repo string Obligatorio

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"

código de estadoDescripción
200

OK

403

Forbidden

404

Resource not found

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

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" \ http(s)://HOSTNAME/api/v3/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.

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 ruta
Nombre, Tipo, Descripción
owner string Obligatorio

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

repo string Obligatorio

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 Obligatorio

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"

código de estadoDescripción
201

Created

403

Forbidden

404

Resource not found

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

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" \ http(s)://HOSTNAME/api/v3/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.

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 ruta
Nombre, Tipo, Descripción
owner string Obligatorio

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

repo string Obligatorio

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

tag_protection_id integer Obligatorio

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"

código de estadoDescripció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"

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" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/tags/protection/TAG_PROTECTION_ID

Response

Status: 204