Skip to content

Commit 3170efe

Browse files
authored
chore(dev): generate beauty changelog (#47)
1 parent e7bdc9b commit 3170efe

File tree

2 files changed

+85
-49
lines changed

2 files changed

+85
-49
lines changed

CHANGELOG.md

+47-15
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,64 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [0.1.1] - 2023-06-22
5+
## [unreleased]
6+
7+
### Features
8+
9+
- Skip selected hosts with new `_meta` option - ([e7bdc9b](https://github.com/pythoninja/sshgen/commit/e7bdc9b4d42d181a72fd9ee97d2e98f16166f3cf))
610

711
### Bug Fixes
812

9-
- Properly include aliases ([PR #3](https://github.com/pythoninja/sshgen/pull/3)) ([3795443](https://github.com/pythoninja/sshgen/commit/37954430364805292f6f3dbe4a4bcd7e31193676))
13+
- Change compatible type - ([67f9099](https://github.com/pythoninja/sshgen/commit/67f9099dacd55c8f94ec4c946b419b072159744e))
14+
15+
### Refactor
16+
17+
- Dynamic format fallback auth - ([763b357](https://github.com/pythoninja/sshgen/commit/763b3570044b231567a69fd5645b4d6e0b3984a8))
1018

11-
### Continuous Integration
19+
### Development
1220

13-
- Add linter and release workflows ([PR #8](https://github.com/pythoninja/sshgen/pull/8)) ([ef77472](https://github.com/pythoninja/sshgen/commit/ef774722d63d528aaa1e679ee857eac7f3ffc9a8))
14-
- Add dependabot ([PR #9](https://github.com/pythoninja/sshgen/pull/9)) ([a006907](https://github.com/pythoninja/sshgen/commit/a006907e4109748e1000b50086487a0a570fd3d2))
21+
- *(dev)* Change type of quotes (experimentally) - ([9b9f75d](https://github.com/pythoninja/sshgen/commit/9b9f75dd2881fbcd0776277a2271558eaf2b3e1d))
22+
- *(dev)* Remove isort rule - ([8815fb9](https://github.com/pythoninja/sshgen/commit/8815fb999bc11e58300181c8cfe47bfa93c09263))
23+
- *(dev)* Add ruff rules - ([a36d07f](https://github.com/pythoninja/sshgen/commit/a36d07ff647249679c6ae495e0bae9874d0ea634))
24+
- *(dev)* Add pre-commit - ([e338bf3](https://github.com/pythoninja/sshgen/commit/e338bf3dc08479021270ab85b2d612e9d7f78d58))
25+
- *(dev)* Bump Python to 3.12 in pyproject.toml - ([9670e35](https://github.com/pythoninja/sshgen/commit/9670e3598fbb76d87362e277e20afa8b5a9f1547))
26+
- *(dev)* Regenerate poetry.lock - ([d4180f0](https://github.com/pythoninja/sshgen/commit/d4180f052b82fef546b7f2c9aff7479aaf5cb622))
1527

1628
### Miscellaneous Tasks
1729

18-
- *(deps-dev)* Bump ruff from 0.0.272 to 0.0.274 ([PR #1](https://github.com/pythoninja/sshgen/pull/1)) ([fa35a10](https://github.com/pythoninja/sshgen/commit/fa35a10cb6aea6df3d947b59560a1d180eb65c03))
19-
- *(dev)* Exclude files from example dir ([ee481ab](https://github.com/pythoninja/sshgen/commit/ee481aba26a796c649cd49800eaee2bba2fa5a45))
20-
- *(dev)* Bump versions in readme ([PR #5](https://github.com/pythoninja/sshgen/pull/5)) ([560f0b6](https://github.com/pythoninja/sshgen/commit/560f0b6e742fdee60d88baebdc7b402a1624a482))
21-
- *(dev)* Add changelog generator ([PR #7](https://github.com/pythoninja/sshgen/pull/7)) ([1618a78](https://github.com/pythoninja/sshgen/commit/1618a78b11d72b7ef60b0397bebd2f5fe72916b1))
22-
- *(dev)* Fix ruff version ([955af2c](https://github.com/pythoninja/sshgen/commit/955af2ca2aa8ccdf0970ee8584144d4c228c6053))
23-
- *(dev)* Add link to changelog for pypi ([8ad9abb](https://github.com/pythoninja/sshgen/commit/8ad9abb87493e14d5651b099b6b721642eb65c79))
24-
- *(dev)* Run changelog generator on version bump ([c9abbec](https://github.com/pythoninja/sshgen/commit/c9abbec5d43ab24e5bba5829d627f7ef1bd1bf22))
25-
- *(dev)* Improve search for version string in readme ([a7344fb](https://github.com/pythoninja/sshgen/commit/a7344fb631bfc3ef62c5694513c0506855d104ba))
30+
- Bump Poetry to 1.6.1 and Python to 3.12 - ([09ac311](https://github.com/pythoninja/sshgen/commit/09ac31117dd580dc8ff2c70a130399f004a76fb6))
31+
- Lint on toml and lock changes ([#15](https://github.com/pythoninja/sshgen/issues/15)) - ([7005a88](https://github.com/pythoninja/sshgen/commit/7005a8880a3b856a688187bd1e3b277f59271bdc))
2632

27-
## [0.1.0] - 2023-06-21
33+
### Documentation
34+
35+
- *(readme)* Update install instructions - ([5abddbc](https://github.com/pythoninja/sshgen/commit/5abddbc37eedeb5d17c89afbd73ed9ebd5a5634a))
36+
- Add toc to readme - ([90636a6](https://github.com/pythoninja/sshgen/commit/90636a697a605cf357a818ec282a3f6da38d224d))
37+
38+
## [0.1.1](https://github.com/pythoninja/sshgen/compare/v0.1.0..v0.1.1) - 2023-06-22
39+
40+
### Bug Fixes
41+
42+
- Properly include aliases ([#3](https://github.com/pythoninja/sshgen/issues/3)) - ([3795443](https://github.com/pythoninja/sshgen/commit/37954430364805292f6f3dbe4a4bcd7e31193676))
43+
44+
### Development
45+
46+
- *(dev)* Improve search for version string in readme - ([a7344fb](https://github.com/pythoninja/sshgen/commit/a7344fb631bfc3ef62c5694513c0506855d104ba))
47+
- *(dev)* Run changelog generator on version bump - ([c9abbec](https://github.com/pythoninja/sshgen/commit/c9abbec5d43ab24e5bba5829d627f7ef1bd1bf22))
48+
- *(dev)* Add link to changelog for pypi - ([8ad9abb](https://github.com/pythoninja/sshgen/commit/8ad9abb87493e14d5651b099b6b721642eb65c79))
49+
- *(dev)* Fix ruff version - ([955af2c](https://github.com/pythoninja/sshgen/commit/955af2ca2aa8ccdf0970ee8584144d4c228c6053))
50+
- *(dev)* Add changelog generator ([#7](https://github.com/pythoninja/sshgen/issues/7)) - ([1618a78](https://github.com/pythoninja/sshgen/commit/1618a78b11d72b7ef60b0397bebd2f5fe72916b1))
51+
- *(dev)* Bump versions in readme ([#5](https://github.com/pythoninja/sshgen/issues/5)) - ([560f0b6](https://github.com/pythoninja/sshgen/commit/560f0b6e742fdee60d88baebdc7b402a1624a482))
52+
- *(dev)* Exclude files from example dir - ([ee481ab](https://github.com/pythoninja/sshgen/commit/ee481aba26a796c649cd49800eaee2bba2fa5a45))
2853

2954
### Miscellaneous Tasks
3055

31-
- *(dev)* Fix project name ([858aced](https://github.com/pythoninja/sshgen/commit/858aced9365754803b3b20162417102ad0378853))
56+
- Add dependabot ([#9](https://github.com/pythoninja/sshgen/issues/9)) - ([a006907](https://github.com/pythoninja/sshgen/commit/a006907e4109748e1000b50086487a0a570fd3d2))
57+
- Add linter and release workflows ([#8](https://github.com/pythoninja/sshgen/issues/8)) - ([ef77472](https://github.com/pythoninja/sshgen/commit/ef774722d63d528aaa1e679ee857eac7f3ffc9a8))
58+
59+
## [0.1.0] - 2023-06-21
60+
61+
### Development
62+
63+
- *(dev)* Fix project name - ([858aced](https://github.com/pythoninja/sshgen/commit/858aced9365754803b3b20162417102ad0378853))
3264

3365
<!-- generated by git-cliff -->

cliff.toml

+38-34
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,35 @@ All notable changes to this project will be documented in this file.\n
55
"""
66

77
# template for the changelog body
8-
# https://tera.netlify.app/docs
8+
# https://keats.github.io/tera/docs/#introduction
99
body = """
10-
{% set_global repo = "https://github.com/pythoninja/sshgen" -%}
1110
{% if version %}\
12-
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
11+
{% if previous.version %}\
12+
## [{{ version | trim_start_matches(pat="v") }}](<REPO>/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
13+
{% else %}\
14+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
15+
{% endif %}\
1316
{% else %}\
1417
## [unreleased]
1518
{% endif %}\
19+
20+
{% macro commit(commit) -%}
21+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}{% if commit.breaking %}[**breaking**] {% endif %}\
22+
{{ commit.message | upper_first }} - ([{{ commit.id | truncate(length=7, end="") }}](<REPO>/commit/{{ commit.id }}))\
23+
{% endmacro -%}
24+
1625
{% for group, commits in commits | group_by(attribute="group") %}
1726
### {{ group | striptags | trim | upper_first }}
18-
{% for commit in commits | filter(attribute="scope") | sort(attribute="scope") %}
19-
- *({{commit.scope}})*{% if commit.breaking %} [**breaking**]{% endif %} \
20-
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ repo}}/commit/{{ commit.id }}))
27+
{% for commit in commits
28+
| filter(attribute="scope")
29+
| sort(attribute="scope") %}
30+
{{ self::commit(commit=commit) }}
2131
{%- endfor -%}
2232
{% raw %}\n{% endraw %}\
2333
{%- for commit in commits %}
24-
{%- if commit.scope -%}
25-
{% else -%}
26-
- {% if commit.breaking %} [**breaking**]{% endif %} \
27-
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ repo}}/commit/{{ commit.id }}))
34+
{%- if not commit.scope -%}
35+
{{ self::commit(commit=commit) }}
2836
{% endif -%}
29-
{% for link in commit.links -%}
30-
, {{ link.text }}({{ link.href }})\
31-
{% endfor -%}
3237
{% endfor -%}
3338
{% endfor %}\n
3439
"""
@@ -40,6 +45,10 @@ footer = """
4045
<!-- generated by git-cliff -->
4146
"""
4247

48+
postprocessors = [
49+
{ pattern = '<REPO>', replace = "https://github.com/pythoninja/sshgen" }, # replace repository URL
50+
]
51+
4352
[git]
4453
# parse the commits based on https://www.conventionalcommits.org
4554
conventional_commits = true
@@ -49,42 +58,37 @@ filter_unconventional = true
4958
split_commits = false
5059
# regex for preprocessing the commit messages
5160
commit_preprocessors = [
52-
{ pattern = '(.*)\(#([0-9]).*', replace = '${1}([PR #${2}](https://github.com/pythoninja/sshgen/pull/${2}))' }
61+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))" },
5362
]
5463
# regex for parsing and grouping commits
5564
commit_parsers = [
56-
{ message = "^feat", group = "Features" },
57-
{ message = "^fix", group = "Bug Fixes" },
58-
{ message = "^doc", group = "Documentation" },
59-
{ message = "^perf", group = "Performance" },
60-
{ message = "^refactor", group = "Refactor" },
61-
{ message = "^style", group = "Styling" },
62-
{ message = "^test", group = "Testing" },
65+
{ message = "^feat", group = "<!-- 0 --> Features" },
66+
{ message = "^fix", group = "<!-- 1 --> Bug Fixes" },
67+
{ message = "^refactor", group = "<!-- 2 --> Refactor" },
68+
{ message = "^test", group = "<!-- 3 --> Testing" },
69+
{ message = "^chore\\(dev\\):", group = "<!-- 4 --> Development" },
70+
{ message = "^chore\\(deps|deps-dev\\):", skip = true },
71+
{ message = "^perf", group = "Performance", skip = true },
72+
{ message = "^style", group = "Styling", skip = true },
6373
{ message = "^chore\\(release\\): v", skip = true },
64-
{ message = "^chore", group = "Miscellaneous Tasks" },
65-
{ message = "^ci", group = "Continuous Integration" },
66-
{ body = ".*security", group = "Security" },
74+
{ message = "^chore|ci", group = "<!-- 6 --> Miscellaneous Tasks" },
75+
{ message = "^doc", group = "<!-- 7 --> Documentation" },
76+
{ body = ".*security", group = "Security" },
6777
]
6878

6979
# protect breaking changes from being skipped due to matching a skipping commit_parser
7080
protect_breaking_commits = false
7181
# filter out the commits that are not matched by commit parsers
72-
filter_commits = false
82+
filter_commits = true
7383
# glob pattern for matching git tags
7484
tag_pattern = "v[0-9]*"
7585
# regex for skipping tags
76-
skip_tags = "v0.1.0-beta.1"
86+
skip_tags = "beta|alpha"
7787
# regex for ignoring tags
78-
ignore_tags = ""
88+
ignore_tags = "rc"
7989
# sort the tags topologically
8090
topo_order = false
8191
# sort the commits inside sections by oldest/newest order
82-
sort_commits = "oldest"
92+
sort_commits = "newest"
8393
# limit the number of commits included in the changelog.
8494
# limit_commits = 42
85-
86-
link_parsers = [
87-
{ pattern = "[fF]ixes #(\\d+)", text = "fixes [#${1}]", href = "https://github.com/pythoninja/sshgen/issues/$1" },
88-
{ pattern = "[cC]loses #(\\d+)", text = "closes [#${1}]", href = "https://github.com/pythoninja/sshgen/issues/$1" },
89-
{ pattern = "[sS]ee #(\\d+)", text = "see [#${1}]", href = "https://github.com/pythoninja/sshgen/issues/$1" },
90-
]

0 commit comments

Comments
 (0)