Skip to content

Bump Increments PATCH Version on ci Commit #695

Closed

Description

@Kurt-von-Laven

Description

commitizen-action cut a spurious patch release when we merged a ci commit, ScribeMD/slack-templates@e2d9df0, to main, because cz bump incorrectly committed a bump. We made many ci commits previously without encountering this issue, and I am not sure what was special about this case.

Steps to reproduce

  1. Run git clone git@github.com:ScribeMD/slack-templates.

  2. Run git checkout 0.6.17^ to checkout the commit that triggered the spurious release.

  3. Refer to our contributing guide if desired to maximize fidelity between our dev environments, but you can most likely get away with simply running commitizen 2.42.1.

  4. Run poetry run cz --no-raise 21 bump --yes --changelog --check-consistency --dry-run. (Omit the poetry run portion if you didn't follow our contributing guide and installed commitizen some other way.)

  5. Observe the following output:

    bump: version 0.6.16 → 0.6.17
    tag to create: 0.6.17
    increment detected: PATCH
    
    ## 0.6.17 (2023-04-05)
    

Current behavior

Here is the pertinent output from commitizen-action:

Commitizen version: 2.42.1
cz --no-raise 21 bump --yes --changelog --check-consistency
bump: version 0.6.16 → 0.6.17
tag to create: 0.6.17
increment detected: PATCH

Desired behavior

Commitizen shouldn't increment the version number when there are no feat, fix, or refactor commits since the previous tag, 0.6.16 in this case.

Screenshots

No response

Environment

  • Commitizen version: 2.42.1
  • Python version: 3.11.2
  • Operating system: Linux

Activity

  1. woile commented on Apr 5, 2023

    @woile
    Member

    Could you share the commit log? Summary and body of each commit message?

    My first guess would be that there was another commit in the branch that triggered the patch

  2. Kurt-von-Laven commented on Apr 5, 2023

    @Kurt-von-Laven
    ContributorAuthor

    Here is the log, but as you can see there are only chore, docs, and style commits in addition to the lone ci commit at the end. We run the commitizen-action after every merge to main and only merge one commit at a time, so it would be even more mysterious if the preceding commits factored into this bug.

  3. Kurt-von-Laven commented on Apr 7, 2023

    @Kurt-von-Laven
    ContributorAuthor

    A subsequent ci commit didn't trigger a release. Still not sure what was different about ScribeMD/slack-templates@e2d9df0.

  4. Kurt-von-Laven commented on Apr 7, 2023

    @Kurt-von-Laven
    ContributorAuthor

    I believe the issue is that one of the lines of the body of the commit message started with the characters "perf," and Commitizen searches the full commit message. It seems like it should only search the subject with the exception of BREAKING CHANGES?

  5. woile commented on Apr 7, 2023

    @woile
    Member

    I think it supports parsing the body for simplicity, this way the regex can include BREAKING CHANGE.
    Which commit has the perf? I think it should only parse if it's perf:, rather than just perf

  6. Kurt-von-Laven commented on Apr 7, 2023

    @Kurt-von-Laven
    ContributorAuthor

    Yes, that is my impression as well. The commit is ScribeMD/slack-templates@e2d9df0. It currently matches perf. Should it match perf[!]?: instead?

  7. woile commented on Apr 7, 2023

    @woile
    Member

    I think it might be this:

    bump_pattern = r"^(BREAKING[\-\ ]CHANGE|feat|fix|refactor|perf)(\(.+\))?(!)?"

    We can be sure with a test probably

  8. Kurt-von-Laven commented on Apr 7, 2023

    @Kurt-von-Laven
    ContributorAuthor

    Sorry, yes, you are correct. I linked to the wrong line.

  9. woile commented on Apr 28, 2023

    @woile
    Member

    Confirmed, gonna submit a patch soon

  10. added a commit that references this issue on Apr 28, 2023
    9211505
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions