Skip to content
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

--bumped-version does not return initial_tag if there are no conventional commits in the history. #805

Closed
1 task done
nhedger opened this issue Aug 21, 2024 · 4 comments · Fixed by #806
Closed
1 task done
Assignees
Labels
bug Something isn't working

Comments

@nhedger
Copy link

nhedger commented Aug 21, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

When using --bumped-version to print the next version on a repository that does not have any conventional commits, the output is empty instead of printing the initial_tag.

Steps To Reproduce

  1. Create a new repo git init
  2. Create a non-conventional commit, e.g. test
  3. Push to the remote
  4. Run git cliff --bumped-version

This prints the warning, but does not print the initial_tag.

Expected behavior

The tag specified in initial_tag is printed even without conventional commits.

Screenshots / Logs

No response

Software information

  • Operating system: macOS
  • Rust version:
  • Project version: 2.4.0

Additional context

Config

[changelog]
header = ""
body = """
{% for commit in commits %}
  {% if commit.github.pr_title -%}
    {%- set commit_message = commit.github.pr_title -%}
  {%- else -%}
    {%- set commit_message = commit.message -%}
  {%- endif -%}
  - {{ commit_message | split(pat="\n") | first | trim }}\
    {% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%}
    {% if commit.github.pr_number %} in \
      [#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }}) \
    {%- endif %}
{%- endfor -%}

{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
  {% raw %}\n{% endraw -%}
  ## New Contributors
{%- endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
  - @{{ contributor.username }} made their first contribution
    {%- if contributor.pr_number %} in \
      [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
    {%- endif %}
{%- endfor -%}
{%- endif -%}

{% if version %}
    {% if previous.version %}
      **Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
    {% endif %}
{% else -%}
  {% raw %}\n{% endraw %}
{% endif %}

{%- macro remote_url() -%}
  https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
"""
footer = ""
trim = true

[git]
conventional_commits = true
filter_unconventional = true
split_commits = false
commit_parsers = [
    { message = "^feat", group = "<!-- 0 -->🚀 Features" },
    { message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
    { message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
    { message = "^perf", group = "<!-- 3 -->⚡ Performance" },
    { message = "^chore\\(deps.*\\)", skip = true },
    { message = "^chore|^ci", group = "<!-- 4 -->⚙️ Miscellaneous" },
    { message = "^revert", group = "<!-- 5 -->◀️ Revert" },
]
sort_commits = "oldest"

[bump]
initial_tag = "0.1.0"

[remote.github]
owner = "nhedger"
repo = "repo"
@nhedger nhedger added the bug Something isn't working label Aug 21, 2024
Copy link

welcome bot commented Aug 21, 2024

Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️

@nhedger nhedger changed the title --bumped-version does not return initial_tag if there are not conventional commits in the history. --bumped-version does not return initial_tag if there are no conventional commits in the history. Aug 21, 2024
@orhun
Copy link
Owner

orhun commented Aug 21, 2024

Hey, #806 fixes this. Are you able to test it locally? 😊

@nhedger
Copy link
Author

nhedger commented Aug 21, 2024

Hey @orhun,

Thanks a lot, it seems to work correctly.

Here's the output using the latest stable:

~/code/repro/cliff GITHUB_TOKEN="$(gh auth token)" git-cliff  --bumped-version
 WARN  git_cliff_core::changelog > You are using an experimental feature! Please report bugs at <https://git-cliff.org/issues>

And here's the one using the version built from the source of #806

~/code/repro/cliff GITHUB_TOKEN="$(gh auth token)" ~/code/contributing/git-cliff/target/release/git-cliff  --bumped-version
 WARN  git_cliff_core::changelog > You are using an experimental feature! Please report bugs at <https://git-cliff.org/issues>
 WARN  git_cliff_core::config    > No releases found, using initial tag '0.1.0' as the next version.
0.1.0

@orhun
Copy link
Owner

orhun commented Aug 22, 2024

Perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants