Tag¶
Tags mark commits with a version label. Through the API you can list, create, and delete repository tags, and manage protected tag rules (restricting who can create, delete, or modify which tags).
Objects¶
| Object | Description | Related endpoint |
|---|---|---|
| Tag | Tag name and the commit it points to | List all tags of the project |
| Protected tag rule | Matching rules, create/delete permissions, details | List project protected tags |
Identification¶
- A repository is identified by
owner+repo, and a tag bytag_name. - Creating and modifying protected rules specify the matching rules in the request body; only deletion and details use
tag_name.
Common tasks¶
| Task | Endpoint |
|---|---|
| List all tags | GET /api/v5/repos/{owner}/{repo}/tags |
| Create a tag | POST /api/v5/repos/{owner}/{repo}/tags |
| Delete a tag | DELETE /api/v5/repos/{owner}/{repo}/tags/{tag_name} |
| List protected tag rules | GET /api/v5/repos/{owner}/{repo}/protected_tags |
| Create a protected tag rule | POST /api/v5/repos/{owner}/{repo}/protected_tags |
| Modify a protected tag rule | PUT /api/v5/repos/{owner}/{repo}/protected_tags |
| Get protected tag details | GET /api/v5/repos/{owner}/{repo}/protected_tags/{tag_name} |
| Delete a protected tag rule | DELETE /api/v5/repos/{owner}/{repo}/protected_tags/{tag_name} |
Notes¶
- Regular tags use
/tagsand protected tags use/protected_tags. The two path groups are parallel; deleting from the wrong group does not raise a semantic error, but the result is completely different. - Both creating and modifying protected rules use the same path
…/protected_tagswithout{tag_name}, distinguished by method (POSTto create,PUTto modify); only deletion and details include{tag_name}. - When a tag name contains special characters such as
/, escape it according to path parameter rules; otherwise it will be treated as a multi-level path. - A Release is published by tag. Creating a tag and creating a Release are two steps: first create the tag, then create the version in the Release section.
Endpoint list¶
This module has 8 endpoints.
| # | Endpoint | Method and path | Description |
|---|---|---|---|
| 1 | List all tags of the project | GET /api/v5/repos/{owner}/{repo}/tags |
Call this endpoint to list all tags of the project. |
| 2 | Create a tag for a repository | POST /api/v5/repos/{owner}/{repo}/tags |
Call this endpoint to create a tag for a repository. |
| 3 | Delete a tag from a repository | DELETE /api/v5/repos/{owner}/{repo}/tags/{tag_name} |
Call this endpoint to delete a tag from a repository. |
| 4 | List project protected tags | GET /api/v5/repos/{owner}/{repo}/protected_tags |
This endpoint lists the protected tags in the specified repository, returns the name of each protected tag and the minimum access level required to create it, and supports pagination, … |
| 5 | Create a project protected tag | POST /api/v5/repos/{owner}/{repo}/protected_tags |
This endpoint creates a project protected tag in the specified repository, sets the tag name and the access level allowed to create it, and can also specify custom roles with creation permission… |
| 6 | Modify a project protected tag | PUT /api/v5/repos/{owner}/{repo}/protected_tags |
This endpoint modifies a project protected tag in the specified repository. It can set the tag name and the access level allowed to create it, to control tag creation permissions. |
| 7 | Delete a project protected tag | DELETE /api/v5/repos/{owner}/{repo}/protected_tags/{tag_name} |
This endpoint deletes a protected tag in the specified repository. You must provide the namespace address to which the repository belongs, the repository path, and the tag name. After deletion the tag is no longer protected, and on success the endpoint… |
| 8 | Get project protected tag details | GET /api/v5/repos/{owner}/{repo}/protected_tags/{tag_name} |
This endpoint gets the details of a protected tag in the specified repository, returns the tag name, the minimum role level allowed to create (push) the tag, and the corresponding role… |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc