From 7d433dd3b51a1f71f14f6c6d313c173eb9115f43 Mon Sep 17 00:00:00 2001 From: Danny Brito Date: Thu, 8 Feb 2024 17:57:24 +0000 Subject: [PATCH] change repo-path default fo release-note generate --- cmd/release-notes/generate.go | 4 +--- pkg/notes/options/options.go | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/release-notes/generate.go b/cmd/release-notes/generate.go index 3fb2152b22b..7bec757491d 100644 --- a/cmd/release-notes/generate.go +++ b/cmd/release-notes/generate.go @@ -18,8 +18,6 @@ package main import ( "fmt" - "os" - "path/filepath" "strings" "github.com/spf13/cobra" @@ -120,7 +118,7 @@ func addGenerateFlags(subcommand *cobra.Command) { subcommand.PersistentFlags().StringVar( &opts.RepoPath, "repo-path", - env.Default("REPO_PATH", filepath.Join(os.TempDir(), "k8s-repo")), + env.Default("REPO_PATH", ""), "Path to a local Kubernetes repository, used only for tag discovery.", ) diff --git a/pkg/notes/options/options.go b/pkg/notes/options/options.go index 3163493df50..4fc0d583a42 100644 --- a/pkg/notes/options/options.go +++ b/pkg/notes/options/options.go @@ -20,6 +20,7 @@ import ( "errors" "fmt" "os" + "path/filepath" "strings" "github.com/sirupsen/logrus" @@ -194,6 +195,11 @@ func (o *Options) ValidateAndFinish() (err error) { ) } + // Set RepoPath to /- if empty + if o.RepoPath == "" { + o.RepoPath = filepath.Join(os.TempDir(), fmt.Sprintf("%s-%s", o.GithubOrg, o.GithubRepo)) + } + // Check if we want to automatically discover the revisions if o.DiscoverMode != RevisionDiscoveryModeNONE { if err := o.resolveDiscoverMode(); err != nil {