diff --git a/internal/pipe/changelog/changelog.go b/internal/pipe/changelog/changelog.go index 47eccd7e4ae..def2ad60db0 100644 --- a/internal/pipe/changelog/changelog.go +++ b/internal/pipe/changelog/changelog.go @@ -49,7 +49,7 @@ func (Pipe) Run(ctx *context.Context) error { } ctx.ReleaseNotes = notes - if ctx.ReleaseNotes != "" { + if ctx.ReleaseNotesFile != "" || ctx.ReleaseNotesTmpl != "" { return nil } diff --git a/internal/pipe/changelog/changelog_test.go b/internal/pipe/changelog/changelog_test.go index 4cc090e7159..886b9fa23bf 100644 --- a/internal/pipe/changelog/changelog_test.go +++ b/internal/pipe/changelog/changelog_test.go @@ -25,13 +25,27 @@ func TestChangelogProvidedViaFlag(t *testing.T) { require.Equal(t, "c0ff33 coffeee\n", ctx.ReleaseNotes) } -func TestChangelogProvidedViaFlagIsAnWhitespaceOnlyFile(t *testing.T) { +func TestChangelogProvidedViaFlagIsAWhitespaceOnlyFile(t *testing.T) { ctx := context.New(config.Project{}) ctx.ReleaseNotesFile = "testdata/changes-empty.md" require.NoError(t, Pipe{}.Run(ctx)) require.Equal(t, "\n", ctx.ReleaseNotes) } +func TestChangelogProvidedViaFlagIsReallyEmpty(t *testing.T) { + ctx := context.New(config.Project{}) + ctx.ReleaseNotesFile = "testdata/changes-really-empty.md" + require.NoError(t, Pipe{}.Run(ctx)) + require.Equal(t, "", ctx.ReleaseNotes) +} + +func TestChangelogTmplProvidedViaFlagIsReallyEmpty(t *testing.T) { + ctx := context.New(config.Project{}) + ctx.ReleaseNotesTmpl = "testdata/changes-really-empty.md" + require.NoError(t, Pipe{}.Run(ctx)) + require.Equal(t, "", ctx.ReleaseNotes) +} + func TestTemplatedChangelogProvidedViaFlag(t *testing.T) { ctx := context.New(config.Project{}) ctx.ReleaseNotesFile = "testdata/changes.md" diff --git a/internal/pipe/changelog/testdata/changes-really-empty.md b/internal/pipe/changelog/testdata/changes-really-empty.md new file mode 100644 index 00000000000..e69de29bb2d