Skip to content

Commit 7c838b9

Browse files
committed
fix: adjustments for commitizen tool-chain
note: new parameter "incremental" in template is assumed to be provided in a future standard commitizen release small change to changelog template
1 parent 2b902a2 commit 7c838b9

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ repos:
1010
rev: v4.6.0
1111
hooks:
1212
- id: trailing-whitespace
13+
exclude: CHANGELOG.md
1314
- id: check-added-large-files
1415
- id: check-merge-conflict
1516
- id: check-shebang-scripts-are-executable
@@ -22,6 +23,7 @@ repos:
2223
- id: check-yaml
2324
args: [ '--unsafe' ] # needed for !! tags in mkdocs.yml
2425
- id: end-of-file-fixer
26+
exclude: CHANGELOG.md
2527
- id: mixed-line-ending
2628
args: [ '--fix=auto' ] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows
2729
- id: detect-private-key

changelog_commitizen-template.md.j2

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
{# MACRO: Capitalize the first letter of a string only #}
2-
{% macro capitalize_first_letter_only(sentence) %}
3-
{{ (sentence[0] | upper) ~ sentence[1:] }}
4-
{% endmacro %}
1+
{% if not incremental %}
52
# CHANGELOG
63

4+
5+
{% endif %}
6+
{# MACRO: Capitalize the first letter of a string only #}
7+
{% macro capitalize_first_letter_only(sentence) %}
8+
{{ (sentence[0] | upper) ~ sentence[1:] }}
9+
{% endmacro %}
10+
711
{% for entry in tree %}
812

9-
## [{{ entry.version }}](https://github.com/dornech/utils-COMobjects/releases/tag/{{ entry.version }}) {% if entry.date %} ({{ entry.date }}) {% endif %}
13+
## [{{ entry.version }}](https://github.com/dornech/pytestdornech/releases/tag/{{ entry.version }}) {% if entry.date %}({{ entry.date }}){% endif %}
1014

1115
{% for change_type, changes in entry.changes.items() %}
1216

@@ -15,9 +19,9 @@
1519
{% endif %}
1620
{% for change in changes %}
1721
{% if change.scope %}
18-
- **{{ change.scope }}**: {{ capitalize_first_letter_only(change.message) }} (['{{ change.sha1[:7] }}'](https://github.com/dornech/utils-COMobjects/commit/{{ change.sha1 }}))
22+
- **{{ change.scope }}**: {{ capitalize_first_letter_only(change.message) }} (['{{ change.sha1[:7] }}'](https://github.com/dornech/pytestdornech/commit/{{ change.sha1 }}))
1923
{% elif change.message %}
20-
- {{ capitalize_first_letter_only(change.message) }}(['{{ change.sha1[:7] }}'](https://github.com/dornech/utils-COMobjects/commit/{{ change.sha1 }}))
24+
- {{ capitalize_first_letter_only(change.message) }}(['{{ change.sha1[:7] }}'](https://github.com/dornech/pytestdornech/commit/{{ change.sha1 }}))
2125
{% endif %}
2226

2327
{% endfor %}

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,21 @@ version_scheme = "pep440"
8787
version = "0.0.1"
8888
version_files = ["pyproject.toml:version"]
8989
tag_format = "v$version"
90+
# retry_after_failure = false
9091
update_changelog_on_bump = true
9192
changelog_file = "CHANGELOG.md"
9293
template = "changelog_commitizen-template.md.j2"
94+
post_bump_hooks = [
95+
"echo %CZ_POST_CURRENT_TAG_VERSION% pushed to remote GitHub repository",
96+
"git push origin HEAD",
97+
"git push origin %CZ_POST_CURRENT_TAG_VERSION%",
98+
]
9399

94100
[tool.commitizen.customize]
95-
message_template = "{% if scope %} '{{ change_type }}({{ scope }}): { {message }}' {% else %} '{{ change_type }}: {{ message }}'"
101+
message_template = "{% if scope %} '{{ change_type }}({{ scope }}): {{ message }}' {% else %} '{{ change_type }}: {{ message }}'"
96102
example = "'feat: add new endpoint'or 'feat(api): add new endpoint'"
97103
schema = "'<type>: <subject>' or '<type>(<scope>): <subject>'"
98-
schema_pattern = "(feat|fix|docs|style|refactor|perf|test|chore|build|deps|ci|revert)(\\([^)]+\\))?:\\s.*"
104+
schema_pattern = "(bump|feat|fix|docs|style|refactor|perf|test|chore|build|deps|ci|revert)(\\([^)]+\\))?:\\s.*"
99105
bump_pattern = "^(feat|fix|BREAKING CHANGE)"
100106
bump_map = {"feat" = "MINOR", "fix" = "PATCH", "BREAKING CHANGE" = "MAJOR"}
101107
# user defined changelog format - standard semantic-release + commit-sha and commit-url

0 commit comments

Comments
 (0)