Skip to content

Commit

Permalink
Coherent changelog locations (#76)
Browse files Browse the repository at this point in the history
* use fixed consolidated changelog filename

* output consolidated changelog and rendered changelog to same folder

* update test
  • Loading branch information
endorama authored Aug 16, 2022
1 parent 0071131 commit fbc68d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func BuildCmd(fs afero.Fs) *cobra.Command {
return fmt.Errorf("owner flag malformed: %w", err)
}

filename := viper.GetString("changelog_filename")
src := viper.GetString("fragment_location")
dest := viper.GetString("changelog_destination")

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

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

if err := b.Build(owner, repo); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestBuildCmd(t *testing.T) {
err = cmd.Execute()
require.Nil(t, err)

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

Expand Down
5 changes: 2 additions & 3 deletions internal/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ func setDefaults() {
os.ExpandEnv(viper.GetString("fragment_root")),
viper.GetString("fragment_path")))

viper.SetDefault("changelog_destination", ".")
viper.SetDefault("changelog_filename", "changelog.yaml")
viper.SetDefault("rendered_changelog_destination", ".")
viper.SetDefault("changelog_destination", "changelog")
viper.SetDefault("rendered_changelog_destination", "changelog")
}

func setConstants() {
Expand Down

0 comments on commit fbc68d8

Please sign in to comment.