[API] Add repoCreateTag (#16165)
* Add API CreateTag * Add Test * API: expose Tag Message
This commit is contained in:
parent
19dedc3fa5
commit
f7cd394680
7 changed files with 180 additions and 3 deletions
|
@ -8,6 +8,7 @@ package convert
|
|||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
|
@ -135,6 +136,7 @@ func ToBranchProtection(bp *models.ProtectedBranch) *api.BranchProtection {
|
|||
func ToTag(repo *models.Repository, t *git.Tag) *api.Tag {
|
||||
return &api.Tag{
|
||||
Name: t.Name,
|
||||
Message: strings.TrimSpace(t.Message),
|
||||
ID: t.ID.String(),
|
||||
Commit: ToCommitMeta(repo, t),
|
||||
ZipballURL: util.URLJoin(repo.HTMLURL(), "archive", t.Name+".zip"),
|
||||
|
|
|
@ -7,6 +7,7 @@ package structs
|
|||
// Tag represents a repository tag
|
||||
type Tag struct {
|
||||
Name string `json:"name"`
|
||||
Message string `json:"message"`
|
||||
ID string `json:"id"`
|
||||
Commit *CommitMeta `json:"commit"`
|
||||
ZipballURL string `json:"zipball_url"`
|
||||
|
@ -30,3 +31,11 @@ type AnnotatedTagObject struct {
|
|||
URL string `json:"url"`
|
||||
SHA string `json:"sha"`
|
||||
}
|
||||
|
||||
// CreateTagOption options when creating a tag
|
||||
type CreateTagOption struct {
|
||||
// required: true
|
||||
TagName string `json:"tag_name" binding:"Required"`
|
||||
Message string `json:"message"`
|
||||
Target string `json:"target"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue