You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating a changelog where commits contain conventional commits, the body (the extended commit information) along with the footer information (ticket references information, etc.) is not written to the output file.
Steps to reproduce
cz changelog
Current behavior
Commits that have body and footer information, have this information missing from the changelog.
Desired behavior
Commits that have body and footer information, would have this information shown in the changelog.
Screenshots
No response
Environment
commitizen version 3.2.2
The text was updated successfully, but these errors were encountered:
The commit_parser will parse your commit, and make the capture groups available to your formatter. In the regex string above, we're getting a section after the subject and labeling it "body", and getting any content that starts "Refs: " and labeling it footer.
You can then create a template CHANGELOG.md.j2 like this:
{% for entry in tree %}
{% set entry_title -%}
{{ entry.version }}{% if entry.date %} ({{ entry.date }}){% endif -%}
{%- endset %}
{{ entry_title }}
{{ "=" * entry_title|length }}
{% for change_key, changes in entry.changes.items() %}
{% if change_key %}
{{ change_key }}
{{ "-" * change_key|length }}
{% endif %}
{% for change in changes %}
{% if change.footer %}
{% set ticket = change.footer.split('#')[1] %}
{% endif %}
{% set ticket_link = "[[" + ticket + "](https://blah.atlassian.net/browse/" + ticket + ")] " if ticket else "" %}
{% set commit_link = "[" + change.sha1[:7] + "](" + change.sha1 + ")" %}
{% set scope = "**" + change.scope + "**: " if change.scope else "" %}
- {{ ticket_link }}{{ scope }}{{ change.subject }} {{commit_link}}
{% if change.body %}
{% set lines = change.body.split('\n') %}
{% for line in lines %}
{% set stripped_line = line.strip() -%}
{% if stripped_line.startswith('-') %}
{{ stripped_line }}
{% elif stripped_line %}
- {{ stripped_line }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
Which will use the capture groups subjectbody and footer from the commit_parser is the cz.yaml.
Adjust the regex according to your commit formatting:
Description
When generating a changelog where commits contain conventional commits, the body (the extended commit information) along with the footer information (ticket references information, etc.) is not written to the output file.
Steps to reproduce
cz changelog
Current behavior
Commits that have body and footer information, have this information missing from the changelog.
Desired behavior
Commits that have body and footer information, would have this information shown in the changelog.
Screenshots
No response
Environment
The text was updated successfully, but these errors were encountered: