This version of GitHub Enterprise Server was discontinued on 2024-07-09. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise Server. For help with the upgrade, contact GitHub Enterprise support.
REST API endpoints for repository tags
Use the REST API to manage tags for a repository.
Deprecated - List tag protection states for a repository
Note: This operation is deprecated and will be removed after August 30th 2024 Use the "Repository Rulesets" endpoint instead.
This returns the tag protection states of a repository.
This information is only available to repository administrators.
Parameters for "Deprecated - List tag protection states for a repository"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
HTTP response status codes for "Deprecated - List tag protection states for a repository"
Status code | Description |
---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Code samples for "Deprecated - List tag protection states for a repository"
Request example
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.*"
}
]
Deprecated - Create a tag protection state for a repository
Note: This operation is deprecated and will be removed after August 30th 2024 Use the "Repository Rulesets" endpoint instead.
This creates a tag protection state for a repository. This endpoint is only available to repository administrators.
Parameters for "Deprecated - Create a tag protection state for a repository"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
Name, Type, Description |
---|
pattern string RequiredAn optional glob pattern to match against when enforcing tag protection. |
HTTP response status codes for "Deprecated - Create a tag protection state for a repository"
Status code | Description |
---|---|
201 | Created |
403 | Forbidden |
404 | Resource not found |
Code samples for "Deprecated - Create a tag protection state for a repository"
Request example
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
}
Deprecated - Delete a tag protection state for a repository
Note: This operation is deprecated and will be removed after August 30th 2024 Use the "Repository Rulesets" endpoint instead.
This deletes a tag protection state for a repository. This endpoint is only available to repository administrators.
Parameters for "Deprecated - Delete a tag protection state for a repository"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
tag_protection_id integer RequiredThe unique identifier of the tag protection. |
HTTP response status codes for "Deprecated - Delete a tag protection state for a repository"
Status code | Description |
---|---|
204 | No Content |
403 | Forbidden |
404 | Resource not found |
Code samples for "Deprecated - Delete a tag protection state for a repository"
Request example
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