From ae58b7714c420c2160f9dbcd03ca10f45ab03ac2 Mon Sep 17 00:00:00 2001 From: ffalor <35144141+ffalor@users.noreply.github.com> Date: Sun, 14 May 2023 22:38:49 -0500 Subject: [PATCH] respect GH_REPO env variable in `pr create` --- pkg/cmd/pr/create/create.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/cmd/pr/create/create.go b/pkg/cmd/pr/create/create.go index 4fc61f362..93b61d53d 100644 --- a/pkg/cmd/pr/create/create.go +++ b/pkg/cmd/pr/create/create.go @@ -6,6 +6,7 @@ import ( "fmt" "net/http" "net/url" + "os" "regexp" "strings" "time" @@ -129,6 +130,12 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co opts.TitleProvided = cmd.Flags().Changed("title") opts.RepoOverride, _ = cmd.Flags().GetString("repo") + // Workaround: Due to the way this command is implemented, we need to manually check GH_REPO. + // Commands should use the standard BaseRepoOverride functionality to handle this behavior instead. + if opts.RepoOverride == "" { + opts.RepoOverride = os.Getenv("GH_REPO") + } + noMaintainerEdit, _ := cmd.Flags().GetBool("no-maintainer-edit") opts.MaintainerCanModify = !noMaintainerEdit