diff --git a/main.go b/main.go index e2acaaa..6bf290b 100644 --- a/main.go +++ b/main.go @@ -18,9 +18,13 @@ func main() { if err != nil { gha.Fatalf("failed to get context: %v", err) } + tag := gha.GetInput("tag") + if tag == "" { + tag = ctx.Ref + } - if !strings.HasPrefix(ctx.Ref, "refs/tags/") { - gha.Fatalf("ref %s is not a tag", ctx.Ref) + if !strings.HasPrefix(tag, "refs/tags/") { + gha.Fatalf("ref %s is not a tag", tag) } files := gha.GetInput("files") @@ -54,7 +58,7 @@ func main() { repo := strings.Split(ctx.Repository, "/")[1] rel, err := createOrGetRelease(ctx, c, owner, repo, gitea.CreateReleaseOption{ - TagName: ctx.RefName, + TagName: tag, IsDraft: draft, IsPrerelease: preRelease, Title: title,