diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/release.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/repo/release.go b/routers/repo/release.go index 672741c5ba..efbe6c982f 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -167,6 +167,15 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) { return } + var tagCreatedUnix int64 + tag, err := ctx.Repo.GitRepo.GetTag(form.TagName) + if err == nil { + commit, err := tag.Commit() + if err == nil { + tagCreatedUnix = commit.Author.When.Unix() + } + } + commit, err := ctx.Repo.GitRepo.GetBranchCommit(form.Target) if err != nil { ctx.Handle(500, "GetBranchCommit", err) @@ -190,6 +199,7 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) { Note: form.Content, IsDraft: len(form.Draft) > 0, IsPrerelease: form.Prerelease, + CreatedUnix: tagCreatedUnix, } if err = models.CreateRelease(ctx.Repo.GitRepo, rel); err != nil { |