Skip to content

Can you add the commit sha1 in the changelog command? #987

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

Closed
gsemet opened this issue Feb 14, 2024 · 2 comments · Fixed by #1013
Closed

Can you add the commit sha1 in the changelog command? #987

gsemet opened this issue Feb 14, 2024 · 2 comments · Fixed by #1013

Comments

@gsemet
Copy link

gsemet commented Feb 14, 2024

Description

I would like to be able to customize the changelog template adding the sha1:


{% for change in changes %}
{% if change.scope %}
- *{{ change.scope }}*: {{ change.message }} ({{ change.sha1 }})
{% elif change.message %}
- {{ change.message }} ({{ change.sha1 }})
{% endif %}
{% endfor %}

Thanks

Possible Solution

Add the sha1 in the "Change" object. Maybe author as well.

Additional context

No response

Additional context

No response

noirbizarre added a commit to noirbizarre/commitizen that referenced this issue Mar 10, 2024
noirbizarre added a commit to noirbizarre/commitizen that referenced this issue Mar 10, 2024
noirbizarre added a commit to noirbizarre/commitizen that referenced this issue Mar 10, 2024
@noirbizarre
Copy link
Member

noirbizarre commented Mar 10, 2024

Hi 👋🏼

I created a pull request (#1013) to add this, but given it's not without impact (increase memory usage on changelog generation), it needs to be discussed I think.

Anyway, this is already possible with the following changelog_message_builder_hook

def changelog_message_builder_hook(
        self, parsed_message: dict, commit: git.GitCommit
    ) -> dict | list | None:
		parsed_message.update(
			sha1=commit.rev,
            author=commit.author,
        	author_email=commit.author_email,
		)
        return parsed_message

noirbizarre added a commit to noirbizarre/commitizen that referenced this issue Mar 11, 2024
noirbizarre added a commit that referenced this issue Mar 19, 2024
@gsemet
Copy link
Author

gsemet commented Mar 19, 2024

Hello Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants