Skip to content

Commit fbc68d8

Browse files
authored
Coherent changelog locations (#76)
* use fixed consolidated changelog filename * output consolidated changelog and rendered changelog to same folder * update test
1 parent 0071131 commit fbc68d8

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

cmd/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func BuildCmd(fs afero.Fs) *cobra.Command {
3333
return fmt.Errorf("owner flag malformed: %w", err)
3434
}
3535

36-
filename := viper.GetString("changelog_filename")
3736
src := viper.GetString("fragment_location")
3837
dest := viper.GetString("changelog_destination")
3938

@@ -42,6 +41,7 @@ func BuildCmd(fs afero.Fs) *cobra.Command {
4241
return fmt.Errorf("error parsing flag 'version': %w", err)
4342
}
4443

44+
filename := fmt.Sprintf("%s.yaml", version)
4545
b := changelog.NewBuilder(fs, filename, version, src, dest)
4646

4747
if err := b.Build(owner, repo); err != nil {

cmd/build_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func TestBuildCmd(t *testing.T) {
4848
err = cmd.Execute()
4949
require.Nil(t, err)
5050

51-
changelogFile := path.Join(viper.GetString("changelog_destination"), viper.GetString("changelog_filename"))
51+
changelogFile := path.Join(viper.GetString("changelog_destination"), fmt.Sprintf("%s.yaml", expectedVersion))
5252
content, err := afero.ReadFile(testFs, changelogFile)
5353
require.Nil(t, err)
5454

internal/settings/settings.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ func setDefaults() {
5858
os.ExpandEnv(viper.GetString("fragment_root")),
5959
viper.GetString("fragment_path")))
6060

61-
viper.SetDefault("changelog_destination", ".")
62-
viper.SetDefault("changelog_filename", "changelog.yaml")
63-
viper.SetDefault("rendered_changelog_destination", ".")
61+
viper.SetDefault("changelog_destination", "changelog")
62+
viper.SetDefault("rendered_changelog_destination", "changelog")
6463
}
6564

6665
func setConstants() {

0 commit comments

Comments
 (0)