mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-19 05:00:46 +02:00
Support annotated tags when using create release API (#31840)
This adds a new field, "tag_message", that represents the message of the annotated tag. Resolves #31835. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
0e6c1224e5
commit
416ff1fd31
@ -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"`
|
||||||
|
@ -247,7 +247,9 @@ 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 {
|
// GitHub doesn't have "tag_message", GitLab has: https://docs.gitlab.com/api/releases/#create-a-release
|
||||||
|
// It doesn't need to be the same as the "release note"
|
||||||
|
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.APIError(http.StatusConflict, err)
|
ctx.APIError(http.StatusConflict, err)
|
||||||
} else if release_service.IsErrProtectedTagName(err) {
|
} else if release_service.IsErrProtectedTagName(err) {
|
||||||
|
4
templates/swagger/v1_json.tmpl
generated
4
templates/swagger/v1_json.tmpl
generated
@ -22295,6 +22295,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…
x
Reference in New Issue
Block a user