support non-extension file name

This commit is contained in:
Daylin Morgan 2024-08-06 09:40:41 -05:00
parent 91a370de41
commit e4a304c274
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -9,6 +9,7 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"oizys/internal/oizys" "oizys/internal/oizys"
"strings"
"github.com/charmbracelet/log" "github.com/charmbracelet/log"
"github.com/google/go-github/v63/github" "github.com/google/go-github/v63/github"
@ -154,17 +155,10 @@ func ReadMarkdownFromZip(zipData []byte, fileName string) (string, error) {
return string(content), nil 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{}) { 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) log.Infof("creating dispatch event for %s", workflowFileName)
event := github.CreateWorkflowDispatchEventRequest{Ref: ref, Inputs: inputs} event := github.CreateWorkflowDispatchEventRequest{Ref: ref, Inputs: inputs}
_, err := client.Actions.CreateWorkflowDispatchEventByFileName( _, err := client.Actions.CreateWorkflowDispatchEventByFileName(