Skip to content

No tag found to do an incremental changelog #463

Closed

Description

@12rambau

Description

I want to use commitizen in my repository and automatically bump vresion to pipy (and maybe someday conda-forge). Looking at the documentation I started with github actions that are still not compatible with my repository structure (I have a main branch and I'm working directly on it).

So I wanted to go with the CLI that looks exactly like what i needed:

I created a .cz.yaml file:

commitizen:
  changelog_file: CHANGELOG.md
  changelog_incremental: true
  changelog_start_rev: v0.12.9
  name: cz_conventional_commits
  tag_format: v$major.$minor.$patch$prerelease
  update_changelog_on_bump: true
  version: 0.12.10
  version_files:
  - setup.py:version
  - ost/__init__.py:__version__ 

and did little modifications

Steps to reproduce

When I run cz bump I get the following error message:

No tag found to do an incremental changelog

If I clean the changelog.md file, it works but I then only have the latest tag and not the previous one.

So I changed the .cz.yaml file to bump the changelog in a second step:

update_changelog_on_bump: false

Then the tag is created but running cz changelog end up with the same error message.
When I print my tags they are all here even some that I don't want to use:

$ git tag 

0.10.1
0.12.5
0.12.6
0.9.4
v0.12.10
v0.12.7
v0.12.8
v0.12.9

It looks like a chicken & egg problem, what did I miss in my configuration?

Environment

Commitizen Version: 2.20.2
Python Version: 3.8.3 (default, Oct 14 2020, 12:53:46)
[Clang 11.0.3 (clang-1103.0.32.29)]
Operating System: Darwin

Activity

  1. woile commented on Dec 17, 2021

    @woile
    Member

    I cloned your repo, and I think your main issue is the tag_format, which includes a v now.
    I changed it like this:

    -  tag_format: v$major.$minor.$patch$prerelease
    + tag_format: $major.$minor.$patch$prerelease

    And then created the missing tag (0.12.9).
    After that when doing cz bump it works (you still have to create a new commit because there won't be any).

    Let me know if this helps, because in your examples there are tags that are not available in the repo you linked.

  2. 12rambau commented on Dec 17, 2021

    @12rambau
    ContributorAuthor

    ok now I wrapped my head around it. I was (naively) thinking that tags were pushed to distant repo but nope. So these tags are only existing on my local creating all sort of isssues (actions not triggered), previous tag not existing etc...

    Now that the workflow is clearer to me, it works like a charm. thanks for the guidance !

  3. woile commented on Dec 17, 2021

    @woile
    Member

    Great news!
    What we usually do is let the github action create the tag and then push back to the repo.
    Here's the tutorial for github actions: https://commitizen-tools.github.io/commitizen/tutorials/github_actions/

  4. 12rambau commented on Dec 17, 2021

    @12rambau
    ContributorAuthor

    I'm waiting for this issue to be solved as I'm using a main branch

  5. 12rambau commented on Jan 11, 2022

    @12rambau
    ContributorAuthor

    I'm reopening the issue because it's the exact same problem in another repository. I thought I had understand but it seems I didn't...

    So in this repository: https://github.com/12rambau/sepal_ui I wanted to do the exact same thing: create the changelog on bump.

    currently I'm not. I tried to add to folowing in my .cz.yaml file:

    changelog_incremental: true
    update_changelog_on_bump: true

    But I'm getting the exact same error:

    No tag found to do an incremental changelog
    

    This time I checked my tags and they should all be here with a v_*.*.* value, the last one being v_2.5.3. So what am I missing this time ?

  6. woile commented on Jan 12, 2022

    @woile
    Member

    It works fine on my side. I cloned, run cz bump and the tag created was v_2.5.3 with the changelog.

    My conf:

    $ cz version
    2.17.11
    

    on ubuntu

  7. 12rambau commented on Mar 28, 2022

    @12rambau
    ContributorAuthor

    I think that's because I had manually updated the changelog file. I deleted it on the 2.6.2 release and everything came back to normal

  8. 12rambau commented on Jul 18, 2022

    @12rambau
    ContributorAuthor

    Sorry to reopen it again but I fail to get it every time I want to use the cz bump command it fails because of the changelog (which the main feature of cz for me). All the solutions I found so far are small patches from my side but I would like to better understand what's behinf this error message.

    So still the same old problem, I changed stuff in my repository sepal_ui and on a fresh clone and I run cz bump, result:

    bump: version 2.9.4 → 2.10.0
    tag to create: v_2.10.0
    increment detected: MINOR
    
    No tag found to do an incremental changelog
    

    which is again not working. looking at the tags:
    the last one is v_2.9.4 which should work. could you clone my repository and simply help me diagnose what's wrong ?

  9. 12rambau commented on Jul 21, 2022

    @12rambau
    ContributorAuthor

    I digged a bit in the lib and it seems the problem for me is coming from the way commitizen is recognizing tags in the tag list.

    SIMILARITY_THRESHOLD = 0.89

    I printed the partial result of the evaluation from my side:

    bump: version 2.9.4 → 2.10.0
    tag to create: v_2.10.0
    increment detected: MINOR
    
    ["v_2.9.4: (0.8333333333333334, GitTag('v_2.9.4', 'b01d653a693c700675034e94bdb014cc1ae75afb', '2022-06-09'))"
    

    That's the latest but as .83 < .89 I get an error.

    Would it be possible to reduce the value to let's say .8 ? and add my example to the tests ?

  10. 4 remaining items

  11. Lee-W commented on Jul 23, 2022

    @Lee-W
    Member

    Sounds great! maybe we could list what we have tested, so the next time we want to change the value we'll have a better idea on why we decide to use that value from the very begining

  12. souravjamwal77 commented on Aug 1, 2022

    @souravjamwal77

    Hi I was trying to run cz bump but it's failing with the same error code. Below is my pyproject.toml file

    [tool]
    [tool.commitizen]
    name = "cz_conventional_commits"
    version = "0.0.1"
    tag_format = "v$major.$minor.$patch$prerelease"
    

    Also, I'm not setting any git tags, just trying to use cz directly as a PoC for our CI/CD process.
    Can anyone suggest, what shall I do?

  13. Lee-W commented on Aug 2, 2022

    @Lee-W
    Member

    @souravjamwal77 May I know what was the commit types (e.g., feat, fix)? If there's only ci, doc and etc., commitizen won't bump the version. This is the default bump_map

    bump_map = OrderedDict(

  14. 12rambau commented on Jan 15, 2023

    @12rambau
    ContributorAuthor

    @Lee-W, I will have the time to work on this in the next 2 weeks, where would you like me to write the tests and is there already an example where you create a fake changelog with a normal version tree (to get some inspiration) ?

  15. Lee-W commented on Jan 18, 2023

    @Lee-W
    Member
  16. mmorley0395 commented on Apr 12, 2023

    @mmorley0395

    I'm having the same issue, but only on Github actions.. Doing CZ bump locally seems to work, but using the github actions setup always seems to yield:

     cz --no-raise 21 bump --yes --changelog --check-consistency --changelog-to-stdout >CHANGELOG.md
    bump: version 0.1.0 → 0.1.1
    tag to create: 0.1.1
    increment detected: PATCH
    
    No tag found to do an incremental changelog
    

    Can someone take a look at my repo and settings to see why this might be? link I've tried setting the tag format both with and without a v, but nothing seems to fix it.

    -- EDIT
    I found a fix for my case (which was more a github CI yml issue than the issues listed here, but threw the same error message), I had changed the "body.md" file in the example yml, because i thought it should be the name of your changelog, but that's not the case. changing back to body.md fixed it. I also had to add a permissions:write setting in the yml file to properly push the new release, otherwise the bump occurred in github ci but not the release.

  17. woile commented on Apr 28, 2023

    @woile
    Member

    I've updated the docs for github actions. I think this issue shouldn't be happening anymore.

    Try using latest actions/checkout@v3 and latest commitizen

  18. jjfantini commented on Sep 26, 2023

    @jjfantini

    I had changed from body.md to CHANGELOG.md, and I am still getting this error using the Github action.

    Settings:

    [tool.commitizen]
    name = "cz_conventional_commits"
    version = "0.1.8"
    tag_format = "v$version"
    update_changelog_on_bump = true
    annoted_tag = true
    major_version_zero = true
    version_files = [
        "pyproject.toml:^version",
        "./src/humbl-data/__version__.py"
    ]
    

    Github Action:

    name: Bump version
    
    on:
      push:
        branches:
          - master
    
    permissions:
      contents: write
    
    jobs:
      bump-version:
        if: "!startsWith(github.event.head_commit.message, 'bump:')"
        runs-on: ubuntu-latest
        name: "Bump version and create changelog with commitizen"
        steps:
          - name: Check out
            uses: actions/checkout@v3
            with:
              token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
              fetch-depth: 0
          - name: Create bump and changelog
            uses: commitizen-tools/commitizen-action@master
            with:
              github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
              changelog_increment_filename: CHANGELOG.md
          - name: Release
            uses: softprops/action-gh-release@v1
            with:
              name: humbl-data v${{ env.REVISION }}
              body_path: "CHANGELOG.md"
              tag_name: v${{ env.REVISION }}
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    name: Bump version
    
    on:
      push:
        branches:
          - master
    
    permissions:
      contents: write
    
    jobs:
      bump-version:
        if: "!startsWith(github.event.head_commit.message, 'bump:')"
        runs-on: ubuntu-latest
        name: "Bump version and create changelog with commitizen"
        steps:
          - name: Check out
            uses: actions/checkout@v3
            with:
              token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
              fetch-depth: 0
          - name: Create bump and changelog
            uses: commitizen-tools/commitizen-action@master
            with:
              github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
              changelog_increment_filename: CHANGELOG.md
          - name: Release
            uses: softprops/action-gh-release@v1
            with:
              name: humbl-data v${{ env.REVISION }}
              body_path: "CHANGELOG.md"
              tag_name: v${{ env.REVISION }}
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}name: Bump version
    
    on:
      push:
        branches:
          - master
    
    permissions:
      contents: write
    
    jobs:
      bump-version:
        if: "!startsWith(github.event.head_commit.message, 'bump:')"
        runs-on: ubuntu-latest
        name: "Bump version and create changelog with commitizen"
        steps:
          - name: Check out
            uses: actions/checkout@v3
            with:
              token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
              fetch-depth: 0
          - name: Create bump and changelog
            uses: commitizen-tools/commitizen-action@master
            with:
              github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
              changelog_increment_filename: CHANGELOG.md
          - name: Release
            uses: softprops/action-gh-release@v1
            with:
              name: humbl-data v${{ env.REVISION }}
              body_path: "CHANGELOG.md"
              tag_name: v${{ env.REVISION }}
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}name: Bump version
    
    on:
      push:
        branches:
          - master
    
    permissions:
      contents: write
    
    jobs:
      bump-version:
        if: "!startsWith(github.event.head_commit.message, 'bump:')"
        runs-on: ubuntu-latest
        name: "Bump version and create changelog with commitizen"
        steps:
          - name: Check out
            uses: actions/checkout@v3
            with:
              token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
              fetch-depth: 0
          - name: Create bump and changelog
            uses: commitizen-tools/commitizen-action@master
            with:
              github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
              changelog_increment_filename: CHANGELOG.md
          - name: Release
            uses: softprops/action-gh-release@v1
            with:
              name: humbl-data v${{ env.REVISION }}
              body_path: "CHANGELOG.md"
              tag_name: v${{ env.REVISION }}
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    

    Everything works fine if I comment out changelog_increment_filename: CHANGELOG.md. I just want the newest changes to be shown for each release, ie incremental?

  19. jjfantini commented on Sep 26, 2023

    @jjfantini

    switching to body.md for both instances fixes the issue

  20. TijoT commented on May 28, 2024

    @TijoT

    I was also having similar problem.

    `vscode ➜ /workspaces/Project (proj_branch) $ cz bump
    bump: version 0.0.1 → 0.1.0
    tag to create: v0.1.0
    increment detected: MINOR

    No tag found to do an incremental changelog`

    Deleted the CHANGELOG.md file and committed changes using cz commit. When cz bump is executed, tag is created and CHANGELOG.md file automatically generated.

    `Commit successful!
    vscode ➜ /workspaces/Project (proj_branch) $ cz bump
    bump: version 0.0.1 → 0.1.0
    tag to create: v0.1.0
    increment detected: MINOR

    [proj_branch c7f4000] bump: version 0.0.1 → 0.1.0
    4 files changed, 18 insertions(+), 17 deletions(-)

    Done!`

  21. mateusht-ciandt commented on Nov 8, 2024

    @mateusht-ciandt

    I am facing the same issue when perfoming the first bump with commitizen version: 3.30.0

    $ cz bump
    Tag 0.0.0 could not be found. 
    Possible causes:
    - version in configuration is not the current version
    - tag_format is missing, check them using 'git tag --list'
    
    ? Is this the first tag created? Yes
    bump: version 0.0.0 → 0.1.0
    tag to create: 0.1.0
    increment detected: MINOR
    
    No tag found to do an incremental changelog
    

    Or this

    $ cz bump --yes --changelog --check-consistency --git-output-to-stderr --changelog-to-stdout >body.md
    bump: version 0.0.0 → 0.1.0
    tag to create: 0.1.0
    increment detected: MINOR
    
    No tag found to do an incremental changelog
    
  22. mrclrchtr commented on Apr 22, 2025

    @mrclrchtr

    the same here and somehow irritating... i have invested quite a lot of time to end up here... can the issue please be reopened?

  23. Lee-W commented on Apr 23, 2025

    @Lee-W
    Member

    yep, we could open it. I'm kinda out of bandwidth recently. would appreciate if we could have detailed reproducing steps so that I can get into it quicker when I have time

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions