diff --git a/cmd/create_prs/create_prs.go b/cmd/create_prs/create_prs.go index 1e3bc7d..2ad3983 100644 --- a/cmd/create_prs/create_prs.go +++ b/cmd/create_prs/create_prs.go @@ -142,7 +142,7 @@ func run(c *cobra.Command, _ []string) { } func prDescriptionUnchanged(dir *campaign.Campaign) bool { - originalPrTitleTodo := fmt.Sprintf("TODO: Title of Pull Request (%s)", dir.Name) + originalPrTitleTodo := "TODO: Title of Pull Request" originalPrBodyTodo := "TODO: This file will serve as both a README and the description of the PR." - return dir.PrTitle == originalPrTitleTodo || strings.Contains(dir.PrBody, originalPrBodyTodo) || dir.PrTitle == "" + return strings.Contains(dir.PrTitle, originalPrTitleTodo) || strings.Contains(dir.PrBody, originalPrBodyTodo) || dir.PrTitle == "" } diff --git a/cmd/create_prs/create_prs_test.go b/cmd/create_prs/create_prs_test.go index 7dab17e..672eb23 100644 --- a/cmd/create_prs/create_prs_test.go +++ b/cmd/create_prs/create_prs_test.go @@ -22,7 +22,6 @@ import ( "github.com/skyscanner/turbolift/internal/prompt" "github.com/skyscanner/turbolift/internal/testsupport" "github.com/stretchr/testify/assert" - "path/filepath" "testing" ) @@ -34,8 +33,8 @@ func TestItWarnsIfDescriptionFileTemplateIsUnchanged(t *testing.T) { fakePrompt := prompt.NewFakePromptNo() p = fakePrompt - dirName := testsupport.PrepareTempCampaign(true, "org/repo1", "org/repo2") - testsupport.UseDefaultPrDescription(dirName) + testsupport.PrepareTempCampaign(true, "org/repo1", "org/repo2") + testsupport.UseDefaultPrDescription() out, err := runCommand() assert.NoError(t, err) @@ -55,8 +54,8 @@ func TestItWarnsIfOnlyPrTitleIsUnchanged(t *testing.T) { fakePrompt := prompt.NewFakePromptNo() p = fakePrompt - dirName := testsupport.PrepareTempCampaign(true, "org/repo1", "org/repo2") - testsupport.UsePrTitleTodoOnly(filepath.Base(dirName)) + testsupport.PrepareTempCampaign(true, "org/repo1", "org/repo2") + testsupport.UsePrTitleTodoOnly() out, err := runCommand() assert.NoError(t, err) diff --git a/internal/testsupport/testsupport.go b/internal/testsupport/testsupport.go index 4c15d6d..0055ea2 100644 --- a/internal/testsupport/testsupport.go +++ b/internal/testsupport/testsupport.go @@ -82,14 +82,14 @@ func CreateOrUpdatePrDescriptionFile(filename string, prTitle string, prBody str } } -func UseDefaultPrDescription(dirName string) { - originalPrTitleTodo := fmt.Sprintf("TODO: Title of Pull Request (%s)", dirName) +func UseDefaultPrDescription() { + originalPrTitleTodo := "TODO: Title of Pull Request" originalPrBodyTodo := "TODO: This file will serve as both a README and the description of the PR." CreateOrUpdatePrDescriptionFile("README.md", originalPrTitleTodo, originalPrBodyTodo) } -func UsePrTitleTodoOnly(dirName string) { - CreateOrUpdatePrDescriptionFile("README.md", fmt.Sprintf("TODO: Title of Pull Request (%s)", dirName), "updated PR body") +func UsePrTitleTodoOnly() { + CreateOrUpdatePrDescriptionFile("README.md", "TODO: Title of Pull Request", "updated PR body") } func UsePrBodyTodoOnly() {