Support annotated tags when using create release API

This adds a new field, "tag_message", that represents the message
of the annotated tag.
pull/31840/head
Kemal Zebari 3 months ago
parent b491b2104f
commit 6ec5cb77bd
  1. 1
      modules/structs/release.go
  2. 2
      routers/api/v1/repo/release.go
  3. 4
      templates/swagger/v1_json.tmpl

@ -33,6 +33,7 @@ type Release struct {
type CreateReleaseOption struct { type CreateReleaseOption struct {
// required: true // required: true
TagName string `json:"tag_name" binding:"Required"` TagName string `json:"tag_name" binding:"Required"`
TagMessage string `json:"tag_message"`
Target string `json:"target_commitish"` Target string `json:"target_commitish"`
Title string `json:"name"` Title string `json:"name"`
Note string `json:"body"` Note string `json:"body"`

@ -246,7 +246,7 @@ func CreateRelease(ctx *context.APIContext) {
IsTag: false, IsTag: false,
Repo: ctx.Repo.Repository, Repo: ctx.Repo.Repository,
} }
if err := release_service.CreateRelease(ctx.Repo.GitRepo, rel, nil, ""); err != nil { if err := release_service.CreateRelease(ctx.Repo.GitRepo, rel, nil, form.TagMessage); err != nil {
if repo_model.IsErrReleaseAlreadyExist(err) { if repo_model.IsErrReleaseAlreadyExist(err) {
ctx.Error(http.StatusConflict, "ReleaseAlreadyExist", err) ctx.Error(http.StatusConflict, "ReleaseAlreadyExist", err)
} else if models.IsErrProtectedTagName(err) { } else if models.IsErrProtectedTagName(err) {

@ -20115,6 +20115,10 @@
"type": "boolean", "type": "boolean",
"x-go-name": "IsPrerelease" "x-go-name": "IsPrerelease"
}, },
"tag_message": {
"type": "string",
"x-go-name": "TagMessage"
},
"tag_name": { "tag_name": {
"type": "string", "type": "string",
"x-go-name": "TagName" "x-go-name": "TagName"

Loading…
Cancel
Save