From e4a304c2741782665e1eaf4dacfcc2bdc983f3f4 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 6 Aug 2024 09:40:41 -0500 Subject: [PATCH] support non-extension file name --- pkgs/oizys/internal/github/main.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/pkgs/oizys/internal/github/main.go b/pkgs/oizys/internal/github/main.go index d4803a9..51f2f03 100644 --- a/pkgs/oizys/internal/github/main.go +++ b/pkgs/oizys/internal/github/main.go @@ -9,6 +9,7 @@ import ( "net/http" "net/url" "oizys/internal/oizys" + "strings" "github.com/charmbracelet/log" "github.com/google/go-github/v63/github" @@ -154,17 +155,10 @@ func ReadMarkdownFromZip(zipData []byte, fileName string) (string, error) { return string(content), nil } -// func CI(rest ...string) { -// args := []string{ -// "workflow", "run", "build.yml", -// "-F", fmt.Sprintf("hosts=%s", o.host), -// } -// args = append(args, rest...) -// cmd := exec.Command("gh", args...) -// e.ExitWithCommand(cmd) -// } - func CreateDispatch(workflowFileName string, ref string, inputs map[string]interface{}) { + if !strings.HasSuffix(workflowFileName, ".yml") && !strings.HasSuffix(workflowFileName, ".yaml") { + workflowFileName = workflowFileName + ".yml" + } log.Infof("creating dispatch event for %s", workflowFileName) event := github.CreateWorkflowDispatchEventRequest{Ref: ref, Inputs: inputs} _, err := client.Actions.CreateWorkflowDispatchEventByFileName(