Skip to content

Commit 416ff1f

Browse files
kemzebwxiaoguang
andauthored
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 <[email protected]>
1 parent 0e6c122 commit 416ff1f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

modules/structs/release.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type Release struct {
3333
type CreateReleaseOption struct {
3434
// required: true
3535
TagName string `json:"tag_name" binding:"Required"`
36+
TagMessage string `json:"tag_message"`
3637
Target string `json:"target_commitish"`
3738
Title string `json:"name"`
3839
Note string `json:"body"`

routers/api/v1/repo/release.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ func CreateRelease(ctx *context.APIContext) {
247247
IsTag: false,
248248
Repo: ctx.Repo.Repository,
249249
}
250-
if err := release_service.CreateRelease(ctx.Repo.GitRepo, rel, nil, ""); err != nil {
250+
// GitHub doesn't have "tag_message", GitLab has: https://docs.gitlab.com/api/releases/#create-a-release
251+
// It doesn't need to be the same as the "release note"
252+
if err := release_service.CreateRelease(ctx.Repo.GitRepo, rel, nil, form.TagMessage); err != nil {
251253
if repo_model.IsErrReleaseAlreadyExist(err) {
252254
ctx.APIError(http.StatusConflict, err)
253255
} else if release_service.IsErrProtectedTagName(err) {

templates/swagger/v1_json.tmpl

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)