From 7ec07c23beec27346badaffed42cadd1fc2fdae1 Mon Sep 17 00:00:00 2001 From: knanao Date: Mon, 13 Jun 2022 14:56:22 +0900 Subject: [PATCH 1/3] Fix the default value of showCommitter --- tool/actions-gh-release/release.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/actions-gh-release/release.go b/tool/actions-gh-release/release.go index aa3b088d60..000a736510 100644 --- a/tool/actions-gh-release/release.go +++ b/tool/actions-gh-release/release.go @@ -54,7 +54,7 @@ type ReleaseCommitCategoryConfig struct { type ReleaseNoteGeneratorConfig struct { ShowAbbrevHash bool `json:"showAbbrevHash,omitempty" default:"false"` - ShowCommitter bool `json:"showCommitter,omitempty" default:"true"` + ShowCommitter bool `json:"showCommitter,omitempty" default:"false"` UseReleaseNoteBlock bool `json:"useReleaseNoteBlock,omitempty" default:"false"` UsePullRequestMetadata bool `json:"usePullRequestMetadata,omitempty" default:"false"` CommitInclude ReleaseCommitMatcherConfig `json:"commitInclude,omitempty"` From fe22217d484155050cb292b22a642291a56e0bcb Mon Sep 17 00:00:00 2001 From: knanao Date: Mon, 13 Jun 2022 15:56:09 +0900 Subject: [PATCH 2/3] Fix to avoid breaking chage --- tool/actions-gh-release/release.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tool/actions-gh-release/release.go b/tool/actions-gh-release/release.go index 000a736510..850a5edd45 100644 --- a/tool/actions-gh-release/release.go +++ b/tool/actions-gh-release/release.go @@ -54,7 +54,7 @@ type ReleaseCommitCategoryConfig struct { type ReleaseNoteGeneratorConfig struct { ShowAbbrevHash bool `json:"showAbbrevHash,omitempty" default:"false"` - ShowCommitter bool `json:"showCommitter,omitempty" default:"false"` + ShowCommitter *bool `json:"showCommitter,omitempty" default:"true"` UseReleaseNoteBlock bool `json:"useReleaseNoteBlock,omitempty" default:"false"` UsePullRequestMetadata bool `json:"usePullRequestMetadata,omitempty" default:"false"` CommitInclude ReleaseCommitMatcherConfig `json:"commitInclude,omitempty"` @@ -359,7 +359,7 @@ func renderReleaseNote(p ReleaseProposal, cfg ReleaseConfig) []byte { if gen.ShowAbbrevHash { b.WriteString(fmt.Sprintf(" [%s](https://github.com/%s/%s/commit/%s)", c.AbbreviatedHash, p.Owner, p.Repo, c.Hash)) } - if gen.ShowCommitter { + if gen.ShowCommitter != nil && *gen.ShowCommitter { b.WriteString(fmt.Sprintf(" - by %s", c.Committer)) } b.WriteString("\n") From e060b60336b5e1ee4677455568f36ccb54e350a4 Mon Sep 17 00:00:00 2001 From: knanao Date: Mon, 13 Jun 2022 16:35:04 +0900 Subject: [PATCH 3/3] Fix the failed test --- tool/actions-gh-release/release_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tool/actions-gh-release/release_test.go b/tool/actions-gh-release/release_test.go index 5f47a96998..30e7d5d0bb 100644 --- a/tool/actions-gh-release/release_test.go +++ b/tool/actions-gh-release/release_test.go @@ -24,6 +24,7 @@ import ( ) func TestParseReleaseConfig(t *testing.T) { + fakeShowCommitter := true testcases := []struct { name string configFile string @@ -80,7 +81,7 @@ func TestParseReleaseConfig(t *testing.T) { }, }, ReleaseNoteGenerator: ReleaseNoteGeneratorConfig{ - ShowCommitter: true, + ShowCommitter: &fakeShowCommitter, UseReleaseNoteBlock: true, }, }, @@ -101,6 +102,7 @@ func TestParseReleaseConfig(t *testing.T) { func TestBuildReleaseCommits(t *testing.T) { ctx := context.Background() + fakeShowCommitter := true config := ReleaseConfig{ Tag: "v1.1.0", Name: "hello", @@ -143,7 +145,7 @@ func TestBuildReleaseCommits(t *testing.T) { }, }, ReleaseNoteGenerator: ReleaseNoteGeneratorConfig{ - ShowCommitter: true, + ShowCommitter: &fakeShowCommitter, UseReleaseNoteBlock: true, }, }