From 326e08ff7c0c8d0e1b020e3dfea726492211030c Mon Sep 17 00:00:00 2001 From: ProKn1fe Date: Tue, 20 Feb 2024 19:41:57 +0000 Subject: [PATCH] Update main.go --- main.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 4ec0417..183f966 100644 --- a/main.go +++ b/main.go @@ -19,16 +19,14 @@ func main() { gha.Fatalf("failed to get context: %v", err) } - if !strings.HasPrefix(ctx.Ref, "refs/tags/") { - gha.Fatalf("ref %s is not a tag", ctx.Ref) - } - files := gha.GetInput("files") title := gha.GetInput("title") body := gha.GetInput("body") apiKey := gha.GetInput("api_key") preRelease, _ := strconv.ParseBool(gha.GetInput("pre_release")) draft, _ := strconv.ParseBool(gha.GetInput("draft")) + tagName := gha.GetInput("tag_name"); + if title == "" { title = ctx.RefName } @@ -36,6 +34,13 @@ func main() { apiKey = os.Getenv("GITHUB_TOKEN") } insecure, _ := strconv.ParseBool(gha.GetInput("insecure")) + if tagName == "" { + tagName = ctx.RefName + } +// I don't understend what this doing +// if !strings.HasPrefix(tagName, "refs/tags/") { +// gha.Fatalf("ref %s is not a tag", tagName) +// } client := http.DefaultClient if insecure { @@ -54,7 +59,7 @@ func main() { repo := strings.Split(ctx.Repository, "/")[1] rel, err := createOrGetRelease(ctx, c, owner, repo, gitea.CreateReleaseOption{ - TagName: ctx.RefName, + TagName: tagName, IsDraft: draft, IsPrerelease: preRelease, Title: title,