Points de terminaison d’API REST pour les balises du référentiel
Utilisez l’API REST pour gérer les étiquettes d’un référentiel.
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.
Jetons d’accès affinés pour « Closing down - List tag protection states for a repository »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application GitHub
- Jetons d’accès d’installation d’application GitHub
- Jetons d’accès personnel affiné
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Administration" repository permissions (read)
Paramètres pour « Closing down - List tag protection states for a repository »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
owner string ObligatoireThe account owner of the repository. The name is not case sensitive. |
repo string ObligatoireThe name of the repository without the |
Codes d’état de la réponse HTTP pour « Closing down - List tag protection states for a repository »
| Code d’état | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour « Closing down - List tag protection states for a repository »
Exemple de requête
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/protectionResponse
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.
Jetons d’accès affinés pour « Closing down - Create a tag protection state for a repository »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application GitHub
- Jetons d’accès d’installation d’application GitHub
- Jetons d’accès personnel affiné
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Administration" repository permissions (write)
Paramètres pour « Closing down - Create a tag protection state for a repository »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
owner string ObligatoireThe account owner of the repository. The name is not case sensitive. |
repo string ObligatoireThe name of the repository without the |
| Nom, Type, Description |
|---|
pattern string ObligatoireAn optional glob pattern to match against when enforcing tag protection. |
Codes d’état de la réponse HTTP pour « Closing down - Create a tag protection state for a repository »
| Code d’état | Description |
|---|---|
201 | Created |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour « Closing down - Create a tag protection state for a repository »
Exemple de requête
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.
Jetons d’accès affinés pour « Closing down - Delete a tag protection state for a repository »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application GitHub
- Jetons d’accès d’installation d’application GitHub
- Jetons d’accès personnel affiné
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Administration" repository permissions (write)
Paramètres pour « Closing down - Delete a tag protection state for a repository »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
owner string ObligatoireThe account owner of the repository. The name is not case sensitive. |
repo string ObligatoireThe name of the repository without the |
tag_protection_id integer ObligatoireThe unique identifier of the tag protection. |
Codes d’état de la réponse HTTP pour « Closing down - Delete a tag protection state for a repository »
| Code d’état | Description |
|---|---|
204 | No Content |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour « Closing down - Delete a tag protection state for a repository »
Exemple de requête
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_IDResponse
Status: 204