github tag build should not have changed files (#698)

This commit is contained in:
Anbraten
2022-01-16 18:44:44 +01:00
committed by GitHub
parent 549996cbcd
commit 2f780193b1

View File

@@ -187,12 +187,15 @@ func convertPushHook(from *webhook) *model.Build {
Sender: from.Sender.Login, Sender: from.Sender.Login,
ChangedFiles: files, ChangedFiles: files,
} }
if len(build.Author) == 0 { if len(build.Author) == 0 {
build.Author = from.Head.Author.Username build.Author = from.Head.Author.Username
} }
// if len(build.Email) == 0 { // if len(build.Email) == 0 {
// TODO: default to gravatar? // TODO: default to gravatar?
// } // }
if strings.HasPrefix(build.Ref, "refs/tags/") { if strings.HasPrefix(build.Ref, "refs/tags/") {
// just kidding, this is actually a tag event. Why did this come as a push // just kidding, this is actually a tag event. Why did this come as a push
// event we'll never know! // event we'll never know!
@@ -202,7 +205,11 @@ func convertPushHook(from *webhook) *model.Build {
if strings.HasPrefix(from.BaseRef, "refs/heads/") { if strings.HasPrefix(from.BaseRef, "refs/heads/") {
build.Branch = strings.Replace(from.BaseRef, "refs/heads/", "", -1) build.Branch = strings.Replace(from.BaseRef, "refs/heads/", "", -1)
} }
// tags should not have changed files
build.ChangedFiles = nil
} }
return build return build
} }