From 45e3ed9ed5219e24b5d624ce99395724641a54ac Mon Sep 17 00:00:00 2001 From: BoneAsh Date: Thu, 21 Dec 2023 15:00:51 +0800 Subject: [PATCH] Add release body file --- action.yml | 3 +++ main.go | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/action.yml b/action.yml index 336e73f..e98901c 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,9 @@ inputs: body: description: 'The release body' required: false + body_file: + description: 'The release body file' + required: false pre_release: description: "Whether it's a pre release" required: false diff --git a/main.go b/main.go index 4ec0417..52d9d71 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,14 @@ func main() { files := gha.GetInput("files") title := gha.GetInput("title") body := gha.GetInput("body") + bodyFile := gha.GetInput("body_file") + if body == "" && bodyFile != "" { + f, err := os.ReadFile(bodyFile) + if err != nil { + gha.Fatalf("read body file error: %s", err.Error()) + } + body = string(f) + } apiKey := gha.GetInput("api_key") preRelease, _ := strconv.ParseBool(gha.GetInput("pre_release")) draft, _ := strconv.ParseBool(gha.GetInput("draft"))