diff --git a/pkgs/oizys/cmd/update.go b/pkgs/oizys/cmd/update.go index adbf0bc..ab7e129 100644 --- a/pkgs/oizys/cmd/update.go +++ b/pkgs/oizys/cmd/update.go @@ -16,7 +16,7 @@ var updateCmd = &cobra.Command{ Short: "update and run nixos rebuild", Run: func(cmd *cobra.Command, args []string) { run := github.GetLastUpdateRun() - md, err := github.GetUpateSummary(run.GetID()) + md, err := github.GetUpateSummary(run.GetID(), oizys.GetHost()) if err != nil { log.Fatal(err) } diff --git a/pkgs/oizys/internal/github/main.go b/pkgs/oizys/internal/github/main.go index 0e67cc7..8216766 100644 --- a/pkgs/oizys/internal/github/main.go +++ b/pkgs/oizys/internal/github/main.go @@ -60,10 +60,11 @@ func GetArtifacts(runID int64) (*github.ArtifactList, *github.Response) { return artifactList, resp } -func GetUpdateSummaryArtifact(runID int64) *github.Artifact { +func GetUpdateSummaryArtifact(runID int64, host string) *github.Artifact { + artifactName := fmt.Sprintf("%s-summary", host) artifactList, _ := GetArtifacts(runID) for _, artifact := range artifactList.Artifacts { - if artifact.GetName() == "summary" { + if artifact.GetName() == artifactName { return artifact } } @@ -71,8 +72,8 @@ func GetUpdateSummaryArtifact(runID int64) *github.Artifact { return nil } -func GetUpdateSummaryUrl(runID int64) *url.URL { - artifact := GetUpdateSummaryArtifact(runID) +func GetUpdateSummaryUrl(runID int64, host string) *url.URL { + artifact := GetUpdateSummaryArtifact(runID, host) url, resp, err := client.Actions.DownloadArtifact(context.Background(), "daylinmorgan", "oizys", artifact.GetID(), 4) if err != nil { log.Fatal("failed to get update summary URL", "artifact", artifact.GetID(), "resp", resp) @@ -109,8 +110,8 @@ func GetLastUpdateRun() *github.WorkflowRun { return run } -func GetUpateSummary(runID int64) (string, error) { - url := GetUpdateSummaryUrl(runID) +func GetUpateSummary(runID int64, host string) (string, error) { + url := GetUpdateSummaryUrl(runID, host) bytes := GetUpdateSummaryFromUrl(url) md, err := ReadMarkdownFromZip(bytes, "summary.md") return md, err diff --git a/pkgs/oizys/internal/oizys/main.go b/pkgs/oizys/internal/oizys/main.go index 2e29c6f..10e4ea6 100644 --- a/pkgs/oizys/internal/oizys/main.go +++ b/pkgs/oizys/internal/oizys/main.go @@ -6,6 +6,7 @@ import ( "fmt" "io/fs" "oizys/internal/git" + // "oizys/internal/github" "oizys/internal/ui" "os" @@ -99,6 +100,7 @@ func SetHost(name string) { } } +func GetHost() string { return o.host } func SetVerbose(v bool) { o.verbose = v }