Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/fixtures/test-multiple-commit-parsers/cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration

[changelog]
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group }}
{% for commit in commits %}
- {% if commit.scope %}({{ commit.scope }}) {% endif %}{{ commit.message }}\
{% endfor %}
{% endfor %}
"""

[git]
# Real-world case: the component a commit touches is recorded in a
# `Component:` trailer (git footer), while the change type follows
# conventional commits in the subject. The first two parsers read the
# component out of the footer and set it as the scope with `continue = true`,
# so parsing keeps going. The last two parsers then group the commit by its
# conventional type. Because the grouping parsers only set the fields they
# match, the scope picked up from the footer is preserved.
commit_parsers = [
{ footer = "^Component:Billing$", scope = "billing", continue = true },
{ footer = "^Component:Auth$", scope = "auth", continue = true },
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
]
8 changes: 8 additions & 0 deletions .github/fixtures/test-multiple-commit-parsers/commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e

GIT_COMMITTER_DATE="2022-04-06 01:25:08" git commit --allow-empty -m "Initial commit"
GIT_COMMITTER_DATE="2022-04-06 01:25:09" git commit --allow-empty -m "feat: add invoices" -m "Component: Billing"
GIT_COMMITTER_DATE="2022-04-06 01:25:10" git commit --allow-empty -m "fix: correct totals rounding" -m "Component: Billing"
GIT_COMMITTER_DATE="2022-04-06 01:25:11" git commit --allow-empty -m "feat: add login page" -m "Component: Auth"
git tag v0.1.0
10 changes: 10 additions & 0 deletions .github/fixtures/test-multiple-commit-parsers/expected.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## [0.1.0] - 2022-04-06

### Bug Fixes

- (billing) correct totals rounding

### Features

- (billing) add invoices
- (auth) add login page
1 change: 1 addition & 0 deletions .github/workflows/test-fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ jobs:
- fixtures-name: test-commit-range-with-given-range
command: a140cef^..a9d4050 --ignore-tags "."
- fixtures-name: test-override-scope
- fixtures-name: test-multiple-commit-parsers
- fixtures-name: test-regex-json-array
- fixtures-name: test-release-statistics
previous-release-timestamp: "2022-04-06 01:25:12"
Expand Down
11 changes: 11 additions & 0 deletions git-cliff-core/src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ mod test {
default_scope: None,
scope: None,
skip: None,
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -925,6 +926,7 @@ mod test {
default_scope: None,
scope: None,
skip: Some(true),
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -937,6 +939,7 @@ mod test {
default_scope: None,
scope: None,
skip: Some(true),
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -949,6 +952,7 @@ mod test {
default_scope: None,
scope: None,
skip: Some(true),
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -961,6 +965,7 @@ mod test {
default_scope: Some(String::from("other")),
scope: None,
skip: None,
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -973,6 +978,7 @@ mod test {
default_scope: None,
scope: None,
skip: None,
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -985,6 +991,7 @@ mod test {
default_scope: None,
scope: Some(String::from("documentation")),
skip: None,
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -997,6 +1004,7 @@ mod test {
default_scope: None,
scope: Some(String::from("documentation")),
skip: None,
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -1009,6 +1017,7 @@ mod test {
default_scope: None,
scope: None,
skip: None,
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -1021,6 +1030,7 @@ mod test {
default_scope: None,
scope: Some(String::from("footer")),
skip: None,
r#continue: None,
field: None,
pattern: None,
},
Expand All @@ -1033,6 +1043,7 @@ mod test {
default_scope: Some(String::from("other")),
scope: None,
skip: None,
r#continue: None,
field: None,
pattern: None,
},
Expand Down
Loading
Loading