1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-26 04:22:05 +02:00

fix: changelog filters and sort when using github

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos A Becker 2021-10-06 01:15:31 -03:00
parent 2cf4d28157
commit 1f774d5d6a
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
4 changed files with 6 additions and 4 deletions

View File

@ -66,7 +66,7 @@ func (c *githubClient) Changelog(ctx *context.Context, repo Repo, prev, current
var log []string
for _, commit := range result.Commits {
log = append(log, fmt.Sprintf(
"- %s: %s (@%s)",
"%s: %s (@%s)",
commit.GetSHA(),
strings.Split(commit.Commit.GetMessage(), "\n")[0],
commit.GetAuthor().GetLogin(),

View File

@ -300,5 +300,5 @@ func TestChangelog(t *testing.T) {
log, err := client.Changelog(ctx, repo, "v1.0.0", "v1.1.0")
require.NoError(t, err)
require.Equal(t, "- 6dcb09b5b57875f334f61aebed695e2e4193db5e: Fix all the bugs (@octocat)", log)
require.Equal(t, "6dcb09b5b57875f334f61aebed695e2e4193db5e: Fix all the bugs (@octocat)", log)
}

View File

@ -112,7 +112,9 @@ func buildChangelog(ctx *context.Context) ([]string, error) {
return nil, err
}
entries := strings.Split(log, "\n")
entries = entries[0 : len(entries)-1]
if lastLine := entries[len(entries)-1]; strings.TrimSpace(lastLine) == "" {
entries = entries[0 : len(entries)-1]
}
entries, err = filterEntries(ctx, entries)
if err != nil {
return entries, err

View File

@ -446,7 +446,7 @@ func TestGetChangelogGitHub(t *testing.T) {
}
log, err := l.Log(ctx, "v0.180.1", "v0.180.2")
require.NoError(t, err)
require.Equal(t, "- c90f1085f255d0af0b055160bfff5ee40f47af79: fix: do not skip any defaults (#2521) (@caarlos0)", log)
require.Equal(t, "c90f1085f255d0af0b055160bfff5ee40f47af79: fix: do not skip any defaults (#2521) (@caarlos0)", log)
}
func TestGetChangeloger(t *testing.T) {