MarcoIeni / release-plz

Publish Rust crates from CI with a Release PR.
https://release-plz.ieni.dev
Apache License 2.0
824 stars 81 forks source link

bug: {{ commit.author.name }} not working #1604

Closed andreacfromtheapp closed 2 months ago

andreacfromtheapp commented 2 months ago

Bug description

{{ commit.author.name }} not working in {% macro print_commit(commit) -%}

To Reproduce

Steps to reproduce the behavior:

  1. Given this template - (btw I want to contribute a PR for this template once we fixed this very issue)
  2. Given this cliff.toml - (this is just for manual testing/comparison, not used by release-plz in the end)
  3. Given an existing commit history.
  4. run git cliff -o CHANGELOG.md to fill the file a first time
  5. make some commits just to test the next step
  6. run release-plz update and see that under Unreleased the author is missing (line ending with by on its own)

Expected behavior

each commit should end with an author. e.g: Adding pre-commit hook for convetional - (924c906) by gacallea

Screenshots

0.2.12 by release-plz GitHub Action 0.2.11 and below generated by git cliff -o CHANGELOG.md with the process described in the steps above

Screenshot 2024-08-09 at 10 22 47β€―PM

Environment

Additional context

Please ignore the quirks of the cliff.toml -- namely the broken rewrites and broken links -- as they are irrelevant here.

MarcoIeni commented 2 months ago

This feature is missing. It's not a bug. https://github.com/MarcoIeni/release-plz/issues/989

It's one of my priorities but I didn't find time to work on it :(

andreacfromtheapp commented 2 months ago

Sorry about the bug report then! Thank you for release-plz. <3

MarcoIeni commented 2 months ago

No worries 😁

andreacfromtheapp commented 2 months ago

one question @MarcoIeni: do you like the template at all? should I PR? (ofc minus the broken stuff, which I am removing as we speak). ref: https://github.com/gacallea/freesound-credits/blob/main/CHANGELOG.md

MarcoIeni commented 2 months ago

Sure, the template looks dope! πŸ™Œ Feel free to write your [changelog] section in the website πŸ‘

Tip: Instead of the macro remote_url() you can use remote.link. πŸ‘

MarcoIeni commented 2 months ago

working on this here: https://github.com/MarcoIeni/release-plz/pull/1606

andreacfromtheapp commented 2 months ago

Yay! will do as soon as I am done fixing stuff :)

To be fair: I based it on git-cliff changelog and fixed/added a few things to make it behave with markdownlint (extra spaces, h1 header) and filtered out some others.

One more thing, before I open another useless bug! I noticed that release-plz needs an extra v in place here, to match the same behavior in changelog:

I tried looking at the code but I am a noob. I deduced that release-plz may not be using cliff api tho and some things diverge. Is this extra v a bug I should report?

edit: that v thing is necessary in plz when filtering out like so:

{% if version %}\
    {% if previous.version %}\
        ## [{{ version | trim_start_matches(pat="v") }}]\
            ({{ remote.link }}/compare/v{{ previous.version }}..v{{ version }})
    {% else %}\
        ## [{{ version | trim_start_matches(pat="v") }}]
    {% endif %}\
{% endif %}\
MarcoIeni commented 2 months ago

I didn't get the v issue. However, release-plz offers the release_link variable. Check it out in the docs. It does what you are trying to do for you πŸ‘

We use git cliff api, but we diverge a bit, yes

andreacfromtheapp commented 2 months ago

amazing Marco! works perfectly now :)

I also modified the example PR https://github.com/MarcoIeni/release-plz/pull/1607 to match

MarcoIeni commented 2 months ago

FYI commit.author.name should work now :) just wait for CI to finish in https://github.com/MarcoIeni/release-plz/commit/4e33fe15a66714800b84ea177dc4beb350713a18