Commit graph

23 commits

Author SHA1 Message Date
Trent Albright
4f3fdc4dae
feat: add sprig template functions support (#131)
* cherry-pick from delmendo

* add tests, docs, and lift hermetic restriction

* remove duplicate funcs that are now provided by sprig

* switch func load order to allow built-ins precedence

* Update chglog.go

Co-authored-by: Dirk Elmendorf <dirk@r26d.com>
2021-03-28 22:18:36 -05:00
Mason J. Katz
9a0d584745
feat: add support for rendering .Body after .Subject as part of list (#121)
When attempting to render a commit body below the summary line of the
commit there are two problems:

1) The text needs to be indented two spaces to appear as part of the
list.

2) Notes (e.g. BREAKING CHANGE) are included in the body and end up
being repeating in a Notes section (if this is part of your template).

To address #1 add an `indent` func to the template parsing.
To address #2 add a `TrimmedBody` to the `Commit` fields.

The `TrimmedBody` will include everything in `Body` but not any
`Ref`s, `Note`s, `Mention`s, `CoAuthors`, or `Signers`.

Both the CoAuthors and Signers are now first class in the Commit
struct.

With both of these a template block like:

```
{{ if .TrimmedBody -}}
{{ indent .TrimmedBody 2 }}
{{ end -}}
```

Will render the trimmed down body section as intended.

See TestGeneratorWithTimmedBody for example of desired output.
2021-03-22 16:04:57 -05:00
Louis DeLosSantos
ebff3d0beb
feat: allow tag sorting by semver (#124)
Relates to #123.

While this does not introduce "per-branch" tag parsing it does allow an
alternative tag sorting method which maybe a better solution.

With this commit the user can decide to sort the tags by semver instead
of dates.

This is useful where repositories are utilizing a  stable branch model
and back-ports are interleaved with new releases.

For example, if your mainline is on v3.0.0 with it's last release
1/1/2021 and a back-port release of v2.0.1 is released on 1/2/2021,
sorting by semver will correctly order the change log producing
v2.0.1 -> v2.0.1 -> v3.0.0

This functionality is completely opt-in and defaults to the original
"date" sorting

Signed-off-by: ldelossa <louis.delos@gmail.com>
2021-03-20 17:21:47 -05:00
Derek Smith
ae3382b7c8
chore(ci): add golangci-lint action and apply linting changes (#120)
BREAKING CHANGE: `JiraIssueId` has been renamed to `JiraIssueID`. This impacts the value for `pattern_maps` in `config.yml`.

* chore(ci): add golangci-lint action

* chore(lint): address errcheck lint failures

* chore(lint): address misspell lint failures

* chore(lint): address gocritic lint failures

* chore(lint): address golint lint failures

* chore(lint): address structcheck lint failures

* chore(lint): address gosimple lint failures

* chore(lint): address gofmt lint failures

* chore(ci): port to official golangci-lint github action

* Update golangci configuration for better coverage

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>

* fix: file is not goimports-ed

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>

* fix: golint and exported functions comments

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>

* chore(lint): address gosec G304 warning

* chore(lint): address uparam warnings

* chore(lint): address scopelint lint failures

* fix: cyclomatic complexity

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>

* chore(lint): address prealloc warning, noting that we are warning for now

* chore(lint): address govet and errorlint failures

* chore: clean up defer logic when checking errors

Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-16 21:24:36 -05:00
Mikael Fridh
9d62af2943
feat(flag): --path filtering - refs (#62). Closes #35
* Argument: --path filtering - refs #35
* Minor documentation additions for Paths option
2021-03-12 13:57:00 +01:00
Chao Li
a1c84d7a0d
feat: add Jira integration (#52) 2021-03-11 08:40:32 +01:00
Khosrow Moossavi
44f71cbcd8
feat: Adds 'Custom' sort_type to CommitGroup (#69)
Closes #60
2021-01-09 23:11:18 +01:00
Thierno IB. BARRY
72fb3eac14 feat: add option to filter commits in a case insensitive way 2020-04-13 18:08:02 +02:00
Thierno IB. BARRY
495fa2de57 feat: add upperFirst template function 2020-03-26 01:12:47 +01:00
Chao Li
1198e283de feat: Add --tag-filter-pattern flag.
This flag specifies a regular expression and only matched tags will
be included in change log.

Closes #43
2019-07-10 09:17:01 +08:00
atosatto
dc128028e6 feat: add the contains, hasPrefix, hasSuffix, replace, lower and upper functions to the template functions map
This PR adds the strings.Contains, strings.HasPrefix, strings.HasSuffix, strings.Replace, strings.Lower and strings.Upper to the set of functions
available for usage in the changelog template.
The added functions can be used to manipulate commit messages before rendering the changelog.
2019-02-10 22:34:19 +01:00
vvakame
e407b9a96e fix: Panic occured when exec --next-tag with HEAD with tag 2018-11-09 15:35:18 +09:00
tsuyoshiwada
f8f4ccb8b7 feat: Add --next-tag flag (experimental) 2018-05-05 21:44:16 +09:00
tsuyoshiwada
5ce1760d0f feat: Add Unreleased field to RenderData 2018-05-03 16:57:36 +09:00
tsuyoshiwada
82d0df16a8 feat: Change to kindly error message when git-tag does not exist 2018-04-07 14:57:57 +09:00
tsuyoshiwada
5599878683 refactor: Fix typo 2018-02-18 20:25:10 +09:00
tsuyoshiwada
d55318c7a0 docs: Add godoc 2018-02-18 01:54:44 +09:00
tsuyoshiwada
22cfb51124 refactor: Change to return an error if corresponding commit is empty 2018-02-17 16:38:20 +09:00
tsuyoshiwada
153727ed1a feat: Add commits in commit version struct 2018-02-17 01:38:50 +09:00
tsuyoshiwada
633c7f0e89 feat: Add config normalize process 2018-02-17 01:37:20 +09:00
tsuyoshiwada
8f3171633c refactor: Refactor the main logic 2018-02-16 15:01:56 +09:00
tsuyoshiwada
fd369d4c53 feat: Add MergeCommits and RevertCommits 2018-02-10 22:22:24 +09:00
tsuyoshiwada
6caf676beb feat: First implement 2018-02-10 18:11:50 +09:00