Update main.go
This commit is contained in:
parent
a45bda39c0
commit
326e08ff7c
15
main.go
15
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,
|
||||
|
|
Loading…
Reference in New Issue