Skip to content

Commit 3dab0d1

Browse files
jdrstorhun
andauthored
feat(context): add release commit range (#1138)
Co-authored-by: Orhun Parmaksız <[email protected]>
1 parent 451a694 commit 3dab0d1

File tree

21 files changed

+983
-643
lines changed

21 files changed

+983
-643
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# A Tera template to be rendered for each release in the changelog.
6+
# See https://keats.github.io/tera/docs/#introduction
7+
body = """
8+
{% if version %}\
9+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
10+
{% else %}\
11+
## [unreleased]
12+
{% endif %}
13+
{{ commit_range.from }}..{{ commit_range.to }}
14+
{% for group, commits in commits | group_by(attribute="group") %}
15+
### {{ group | upper_first }}
16+
{% for commit in commits %}
17+
- {{ commit.message | upper_first }}\
18+
{% endfor %}
19+
{% endfor %}\n
20+
"""
21+
22+
[git]
23+
# An array of regex based parsers for extracting data from the commit message.
24+
# Assigns commits to groups.
25+
# Optionally sets the commit's `scope` and can decide to exclude commits from further processing.
26+
commit_parsers = [
27+
{ message = "^feat", group = "Features", default_scope = "app" },
28+
{ message = "^fix", group = "Bug Fixes", scope = "cli" },
29+
]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
git remote add origin https://github.com/orhun/git-cliff-readme-example
5+
git pull origin master
6+
git fetch --tags
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [unreleased]
6+
7+
a140cef0405e0bcbfb5de44ff59e091527d91b38..a9d4050212a18f6b3bd76e2e41fbb9045d268b80
8+
9+
### Bug Fixes
10+
11+
- Rename help argument due to conflict
12+
13+
### Features
14+
15+
- Add ability to parse arrays
16+
- Support multiple file formats
17+
18+
### Chore
19+
20+
- Add release script
21+
22+
### Docs
23+
24+
- Add tested usage example
25+
26+
### Refactor
27+
28+
- Expose string functions
29+
30+
<!-- generated by git-cliff -->
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# A Tera template to be rendered for each release in the changelog.
6+
# See https://keats.github.io/tera/docs/#introduction
7+
body = """
8+
{% if version %}\
9+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
10+
{% else %}\
11+
## [unreleased]
12+
{% endif %}
13+
{{ commit_range.from }}..{{ commit_range.to }}
14+
{% for group, commits in commits | group_by(attribute="group") %}
15+
### {{ group | upper_first }}
16+
{% for commit in commits %}
17+
- {{ commit.message | upper_first }}\
18+
{% endfor %}
19+
{% endfor %}\n
20+
"""
21+
22+
[git]
23+
# An array of regex based parsers for extracting data from the commit message.
24+
# Assigns commits to groups.
25+
# Optionally sets the commit's `scope` and can decide to exclude commits from further processing.
26+
commit_parsers = [
27+
{ message = "^feat", group = "Features", default_scope = "app" },
28+
{ message = "^fix", group = "Bug Fixes", scope = "cli" },
29+
]
30+
sort_commits = "newest"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
git remote add origin https://github.com/orhun/git-cliff-readme-example
5+
git pull origin master
6+
git fetch --tags
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [unreleased]
6+
7+
a9d4050212a18f6b3bd76e2e41fbb9045d268b80..df6aef41292f3ffe5887754232e6ea7831c50ba5
8+
9+
### Features
10+
11+
- Use cache while fetching pages
12+
- Support multiple file formats
13+
14+
## [1.0.1] - 2021-07-18
15+
16+
e4fd3cf8e2e6f49c0b57f66416e886c37cbb3715..06412ac1dd4071006c465dde6597a21d4367a158
17+
18+
### Chore
19+
20+
- Add release script
21+
22+
### Refactor
23+
24+
- Expose string functions
25+
26+
## [1.0.0] - 2021-07-18
27+
28+
a78bc368e9ee382a3016c0c4bab41f7de4503bcd..ad27b43e8032671afb4809a1a3ecf12f45c60e0e
29+
30+
### Bug Fixes
31+
32+
- Rename help argument due to conflict
33+
34+
### Features
35+
36+
- Add ability to parse arrays
37+
38+
### Docs
39+
40+
- Add tested usage example
41+
- Add README.md
42+
43+
<!-- generated by git-cliff -->
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# A Tera template to be rendered for each release in the changelog.
6+
# See https://keats.github.io/tera/docs/#introduction
7+
body = """
8+
{% if version %}\
9+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
10+
{% else %}\
11+
## [unreleased]
12+
{% endif %}
13+
{{ commit_range.from }}..{{ commit_range.to }}
14+
{% for group, commits in commits | group_by(attribute="group") %}
15+
### {{ group | upper_first }}
16+
{% for commit in commits %}
17+
- {{ commit.message | upper_first }}\
18+
{% endfor %}
19+
{% endfor %}\n
20+
"""
21+
22+
[git]
23+
# An array of regex based parsers for extracting data from the commit message.
24+
# Assigns commits to groups.
25+
# Optionally sets the commit's `scope` and can decide to exclude commits from further processing.
26+
commit_parsers = [
27+
{ message = "^feat", group = "Features", default_scope = "app" },
28+
{ message = "^fix", group = "Bug Fixes", scope = "cli" },
29+
]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
git remote add origin https://github.com/orhun/git-cliff-readme-example
5+
git pull origin master
6+
git fetch --tags
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [unreleased]
6+
7+
a9d4050212a18f6b3bd76e2e41fbb9045d268b80..df6aef41292f3ffe5887754232e6ea7831c50ba5
8+
9+
### Features
10+
11+
- Support multiple file formats
12+
- Use cache while fetching pages
13+
14+
## [1.0.1] - 2021-07-18
15+
16+
e4fd3cf8e2e6f49c0b57f66416e886c37cbb3715..06412ac1dd4071006c465dde6597a21d4367a158
17+
18+
### Chore
19+
20+
- Add release script
21+
22+
### Refactor
23+
24+
- Expose string functions
25+
26+
## [1.0.0] - 2021-07-18
27+
28+
a78bc368e9ee382a3016c0c4bab41f7de4503bcd..ad27b43e8032671afb4809a1a3ecf12f45c60e0e
29+
30+
### Bug Fixes
31+
32+
- Rename help argument due to conflict
33+
34+
### Features
35+
36+
- Add ability to parse arrays
37+
38+
### Docs
39+
40+
- Add README.md
41+
- Add tested usage example
42+
43+
<!-- generated by git-cliff -->

.github/fixtures/test-from-context-does-not-discard-fields/context.json

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@
200200
"message": "fix 1, use scope as group",
201201
"body": "Body fix 1",
202202
"footers": [
203-
{ "token": "Fix", "separator": ":", "value": "#1", "breaking": false }
203+
{
204+
"token": "Fix",
205+
"separator": ":",
206+
"value": "#1",
207+
"breaking": false
208+
}
204209
],
205210
"group": "fix",
206211
"breaking_description": null,
@@ -314,7 +319,12 @@
314319
"value": "#3",
315320
"breaking": false
316321
},
317-
{ "token": "Fix", "separator": ":", "value": "#4", "breaking": false }
322+
{
323+
"token": "Fix",
324+
"separator": ":",
325+
"value": "#4",
326+
"breaking": false
327+
}
318328
],
319329
"group": "fix",
320330
"breaking_description": null,
@@ -375,19 +385,37 @@
375385
"timestamp": 0,
376386
"previous": null,
377387
"repository": null,
388+
"commit_range": null,
378389
"submodule_commits": {},
379390
"extra": null,
380-
"github": { "contributors": [] },
381-
"gitlab": { "contributors": [] },
382-
"gitea": { "contributors": [] },
383-
"bitbucket": { "contributors": [] }
391+
"github": {
392+
"contributors": []
393+
},
394+
"gitlab": {
395+
"contributors": []
396+
},
397+
"gitea": {
398+
"contributors": []
399+
},
400+
"bitbucket": {
401+
"contributors": []
402+
}
384403
},
385404
"repository": "/path/to/repository",
405+
"commit_range": null,
386406
"submodule_commits": {},
387407
"extra": null,
388-
"github": { "contributors": [] },
389-
"gitlab": { "contributors": [] },
390-
"gitea": { "contributors": [] },
391-
"bitbucket": { "contributors": [] }
408+
"github": {
409+
"contributors": []
410+
},
411+
"gitlab": {
412+
"contributors": []
413+
},
414+
"gitea": {
415+
"contributors": []
416+
},
417+
"bitbucket": {
418+
"contributors": []
419+
}
392420
}
393-
]
421+
]

0 commit comments

Comments
 (0)