mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-19 20:57:53 +02:00
fix: make --release-notes flags more deterministic (#2888)
* fix: make --release-notes flags more deterministic Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * chore: fmt Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
3426d04837
commit
5f30f3606a
@ -49,7 +49,7 @@ func (Pipe) Run(ctx *context.Context) error {
|
|||||||
}
|
}
|
||||||
ctx.ReleaseNotes = notes
|
ctx.ReleaseNotes = notes
|
||||||
|
|
||||||
if ctx.ReleaseNotes != "" {
|
if ctx.ReleaseNotesFile != "" || ctx.ReleaseNotesTmpl != "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,13 +25,27 @@ func TestChangelogProvidedViaFlag(t *testing.T) {
|
|||||||
require.Equal(t, "c0ff33 coffeee\n", ctx.ReleaseNotes)
|
require.Equal(t, "c0ff33 coffeee\n", ctx.ReleaseNotes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChangelogProvidedViaFlagIsAnWhitespaceOnlyFile(t *testing.T) {
|
func TestChangelogProvidedViaFlagIsAWhitespaceOnlyFile(t *testing.T) {
|
||||||
ctx := context.New(config.Project{})
|
ctx := context.New(config.Project{})
|
||||||
ctx.ReleaseNotesFile = "testdata/changes-empty.md"
|
ctx.ReleaseNotesFile = "testdata/changes-empty.md"
|
||||||
require.NoError(t, Pipe{}.Run(ctx))
|
require.NoError(t, Pipe{}.Run(ctx))
|
||||||
require.Equal(t, "\n", ctx.ReleaseNotes)
|
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) {
|
func TestTemplatedChangelogProvidedViaFlag(t *testing.T) {
|
||||||
ctx := context.New(config.Project{})
|
ctx := context.New(config.Project{})
|
||||||
ctx.ReleaseNotesFile = "testdata/changes.md"
|
ctx.ReleaseNotesFile = "testdata/changes.md"
|
||||||
|
0
internal/pipe/changelog/testdata/changes-really-empty.md
vendored
Normal file
0
internal/pipe/changelog/testdata/changes-really-empty.md
vendored
Normal file
Loading…
x
Reference in New Issue
Block a user