Commit graph

7 commits

Author SHA1 Message Date
David Alpert
2a7ca9ecb0 feat: recognize Jira issue keys in commit body
As outlined in #183 it can be useful when following the
conventional commit syntax to separate conventional
commit type in the subject from work item references
which often appear in the commit body or commit footer

this commit:

- adds a new config option 'jira.issue.key_pattern' which
  is an optional regex used to match issue keys in the
  commit subject and body

- ensures that the Jira Issue Type does not overwrite a
  Conventional Commit Type; the 'jira.issue.type_maps'
  map is only used as a backup when the Conventional
  Commit Type parsed out of the Subject header is empty

- runs the 'jira.issue.key_pattern' regex against both
  the commit Subject header and the entire commit Body

NOTE: the current code assumes that only one Jira work
      item will be bound to a single commit, and this
      appears consistent with the spirit of Conventional
      Commits. I have sometimes found it useful to write
      a Conventional Commit where one 'fix' can close
      multiple Jira work items, so a future issue/change
      might consider updating the model to support multiple
      Jira work items in a single commit message.
2023-11-20 17:37:36 -06:00
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
Chao Li
a1c84d7a0d
feat: add Jira integration (#52) 2021-03-11 08:40:32 +01:00
tsuyoshiwada
d008bef7fb test: Change output test of chglog to keep-a-changelog 2018-05-05 21:44:14 +09:00
tsuyoshiwada
22cfb51124 refactor: Change to return an error if corresponding commit is empty 2018-02-17 16:38:20 +09:00
tsuyoshiwada
8869631aad fix: Fix parsing of revert and body 2018-02-17 02:27:05 +09:00