diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 16af0b0e7924..ea916a107bf3 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -53,16 +53,16 @@ changelog: - go mod tidy groups: - title: Dependency updates - regexp: "^.*(feat|fix)\\(deps\\)*:+.*$" + regexp: '^[0-9a-h]+ (feat|fix)\(deps\):.+$' order: 300 - title: 'New Features' - regexp: "^.*feat[(\\w)]*:+.*$" + regexp: '^[0-9a-h]+ feat(\([[:word:]]+\))??:.+$' order: 100 - title: 'Bug fixes' - regexp: "^.*fix[(\\w)]*:+.*$" + regexp: '^[0-9a-h]+ fix(\([[:word:]]+\))??:.+$' order: 200 - title: 'Documentation updates' - regexp: "^.*docs[(\\w)]*:+.*$" + regexp: ^[0-9a-h]+ doc(\([[:word:]]+\))??:.+$ order: 400 - title: Other work order: 9999 diff --git a/internal/pipe/changelog/changelog_test.go b/internal/pipe/changelog/changelog_test.go index 55bc2deab4b8..2538e068b8f2 100644 --- a/internal/pipe/changelog/changelog_test.go +++ b/internal/pipe/changelog/changelog_test.go @@ -638,12 +638,12 @@ func TestGroup(t *testing.T) { }, { Title: "Features", - Regexp: "^.*feat[(\\w)]*:+.*$", + Regexp: `^[0-9a-h]+ feat(\([[:word:]]+\))??!?:.+$`, Order: 0, }, { Title: "Bug Fixes", - Regexp: "^.*bug[(\\w)]*:+.*$", + Regexp: `^[0-9a-h]+ bug(\([[:word:]]+\))??!?:.+$`, Order: 1, }, { @@ -680,13 +680,13 @@ func TestGroupBadRegex(t *testing.T) { Groups: []config.ChangeLogGroup{ { Title: "Something", - Regexp: "^.*feat[(\\w", // unterminated regex + Regexp: "^.*feat[a-z", // unterminated regex }, }, }, }) ctx.Git.CurrentTag = "v0.0.2" - require.EqualError(t, Pipe{}.Run(ctx), `failed to group into "Something": error parsing regexp: missing closing ]: `+"`"+`[(\w`+"`") + require.EqualError(t, Pipe{}.Run(ctx), "failed to group into \"Something\": error parsing regexp: missing closing ]: `[a-z`") } func TestChangelogFormat(t *testing.T) { diff --git a/www/docs/customization/changelog.md b/www/docs/customization/changelog.md index 30f195612188..694e690d071c 100644 --- a/www/docs/customization/changelog.md +++ b/www/docs/customization/changelog.md @@ -51,14 +51,15 @@ changelog: # Order value defines the order of the groups. # Proving no regex means all commits will be grouped under the default group. # Groups are disabled when using github-native, as it already groups things by itself. + # Matches are performed against strings of the form: " ". # # Default is no groups. groups: - title: Features - regexp: "^.*feat[(\\w)]*:+.*$" + regexp: '^[0-9a-h]+ feat(\([[:word:]]+\))??!?:.+$' order: 0 - title: 'Bug fixes' - regexp: "^.*fix[(\\w)]*:+.*$" + regexp: '^[0-9a-h]+ bug(\([[:word:]]+\))??!?:.+$' order: 1 - title: Others order: 999