semantic-release / semantic-release/commit-analyzer

How do I add a releaseRule that also respects the `!` for a breaking change? (conventionalcommits preset)

Open
#413 5 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
448
Forks
82
Avg merge
17h 41m
Merged PRs (30d)
4

Description

We’re using the conventionalcommits preset. In this preset, adding an exclamation after the type triggers a breaking change/major version bump.

Using the default releaseRules this works. feat!:, fix!: and perf!: are recognized as major/breaking changes.

In fact, anything with an exclamation triggers a major/breaking change, such as docs!: or even allGloryToTheHypnoToad!:

Now we want to add refactor as a type.

plugins: [
    [
      '@semantic-release/commit-analyzer',
      {
        preset: 'conventionalcommits'
        releaseRules: [{ type: 'refactor', release: 'patch' }]
      }
    ],

After adding this, refactor: triggers a patch change, as expected.

But refactor!: no longer triggers a major version bump.

How do we get this to work?

Edit to add version info: semantic-release 19.0.5, @semantic-release/commit-analyzer 9.0.2, Node 16.19.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the @semantic-release/commit-analyzer configuration using the conventionalcommits preset and the custom releaseRules shown in the issue. Reproduce the behavior with the reported semantic-release 19.0.5, commit-analyzer 9.0.2, and Node 16.19.0 versions, then compare default and custom rule handling. Done means refactor: produces a patch release while refactor!: still produces a major release.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
release
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.