Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add parameter to changelog generation #1625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dornech wants to merge 3 commits into commitizen-tools:master
base: master
Choose a base branch
Loading
from dornech:master

Conversation

@dornech
Copy link

@dornech dornech commented Sep 20, 2025
edited
Loading

... to identify incremental generation run in the jinja template.
This allows to include / exclude f. e. header lines form the current generation run to avoid multiple generation of header line(s)

Please refer to #1620

tree,
self.cz.template_loader,
self.template,
incremental=self.incremental
Copy link
Collaborator

@bearomorphism bearomorphism Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing comma at the end of line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, I tested locally and did the change directly in GitHub ...
But thanks it is being considered at least for release 4.11, I think it is a simple change with real benefit for many.

bearomorphism reacted with thumbs up emoji
Copy link
Collaborator

It'd be better to add test cases related to #1620, thanks.

Lee-W reacted with thumbs up emoji

@Lee-W Lee-W added this to the 4.11.0 milestone Sep 21, 2025
fix of previous change/commit regarding same topic
Copy link

codecov bot commented Sep 21, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.25%. Comparing base (120d514) to head (2facaca).
⚠️ Report is 948 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@
## master #1625 +/- ##
==========================================
+ Coverage 97.33% 98.25% +0.91% 
==========================================
 Files 42 58 +16 
 Lines 2104 2694 +590 
==========================================
+ Hits 2048 2647 +599 
+ Misses 56 47 -9 
Flag Coverage Δ
unittests 98.25% <ø> (+0.91%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

Hi @dornech , can you help to improve the test coverage when you have a moment? Thanks!

Copy link
Author

dornech commented Jan 17, 2026

Hm. I am adfraid I am not experienced enough with pytest and etc to knpw what to do.

Copy link
Collaborator

It's ok 👌
Thanks a lot for submitting the issue

Copy link
Collaborator

bearomorphism commented Jan 18, 2026
edited
Loading

Hi @dornech ,

I went through the discussion #1620 and our current codebase.

You can refer to the tests with --incremental flags in test_changelog_command.py, and provide the full template file you are using, since the existing templates in our code base cannot repro the problem you encountered.

I can continue to work on for the test. The discussion is definitely great for those people who want a # CHANGELOG level 1 header in their changelog file.

Copy link
Author

dornech commented Jan 18, 2026

Here you go:

{%- raw %}{% if not incremental %}
# CHANGELOG
{% endif %}{% endraw %}
{% raw %}{# Macro: Capitalize the first letter of a string only #}
{% macro capitalize_first_letter_only(sentence) %}
{{ (sentence[0] | upper) ~ sentence[1:] }}
{% endmacro %}{% endraw %}
{% raw %}{% for entry in tree %}{% endraw %}
## [{% raw %}{{ entry.version }}]({% endraw %}{{ cookiecutter.project_repo }}{% raw %}/releases/tag/{{ entry.version }}) {% if entry.date %} ({{ entry.date }}) {% endif %}{% endraw %}
{% raw %}{% for change_type, changes in entry.changes.items() %}{% endraw %}
{% raw %}{% if change_type %}{% endraw %}
### {% raw %}{{ capitalize_first_letter_only(change_type) }}{% endraw %}
{% raw %}{% endif %}{% endraw %}
{% raw %}{% for change in changes %}{% endraw %}
{% raw %}{% if change.scope %}{% endraw %}
- {% raw %}**{{ change.scope }}**: {{ capitalize_first_letter_only(change.message) }} (['{{ change.sha1[:7] }}']({% endraw %}{{ cookiecutter.project_repo }}{% raw %}/commit/{{ change.sha1 }})){% endraw %}
{% raw %}{% elif change.message %}{% endraw %}
- {% raw %}{{ capitalize_first_letter_only(change.message) }}(['{{ change.sha1[:7] }}']({% endraw %}{{ cookiecutter.project_repo }}{% raw %}/commit/{{ change.sha1 }})){% endraw %}
{% raw %}{% endif %}{% endraw %}
{% raw -%}
{% endfor %}
{% endfor %}
{% endfor %}
{% endraw -%}

You may refer to my repository https://github.com/dornech/the-hatchlor-enhanced/blob/main/%7B%7Bcookiecutter.project_slug%7D%7D/changelog_commitizen-template.md.j2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bearomorphism bearomorphism bearomorphism left review comments

@woile woile Awaiting requested review from woile woile is a code owner

@Lee-W Lee-W Awaiting requested review from Lee-W Lee-W is a code owner

@noirbizarre noirbizarre Awaiting requested review from noirbizarre noirbizarre is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /