From c4227455e3ca5aaf288442331ac36c7a6e89f565 Mon Sep 17 00:00:00 2001 From: Daniel Leong Date: Tue, 1 Sep 2020 12:40:36 -0400 Subject: [PATCH] Prepend PR body defaults to the selected template (if any) See #1570 --- pkg/cmd/pr/shared/title_body_survey.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/pr/shared/title_body_survey.go b/pkg/cmd/pr/shared/title_body_survey.go index 3afeba803..70308e310 100644 --- a/pkg/cmd/pr/shared/title_body_survey.go +++ b/pkg/cmd/pr/shared/title_body_survey.go @@ -154,18 +154,24 @@ func TitleBodySurvey(io *iostreams.IOStreams, editorCommand string, issueState * templateContents := "" if providedBody == "" { + issueState.Body = defs.Body + if len(nonLegacyTemplatePaths) > 0 { var err error templateContents, err = selectTemplate(nonLegacyTemplatePaths, legacyTemplatePath, issueState.Type) if err != nil { return err } - issueState.Body = templateContents + } else if legacyTemplatePath != nil { templateContents = string(githubtemplate.ExtractContents(*legacyTemplatePath)) - issueState.Body = templateContents - } else { - issueState.Body = defs.Body + } + + if templateContents != "" { + if issueState.Body != "" { + issueState.Body += "\n\n" + } + issueState.Body += templateContents } }