semantic-release / semantic-release/commit-analyzer

Providing a PR description breaks custom releaseRules

Open
#535 1 comment 0 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

Hi all, my intention is to release a new patch version when the commit message doesn't start with fix: or feat:.

These custom releaseRules work, except when the PR contains a description. PRs are created using Azure DevOps.

package.json
"release": {
    "plugins": [
        [
            "@semantic-release/commit-analyzer",
            {
                "preset": "angular",
                "releaseRules": [
                    {
                        "subject": "**",
                        "release": "patch"
                    },
                    {
                        "message": "**",
                        "release": "patch"
                    },
                    {
                        "tag": "**",
                        "release": "patch"
                    },
                    {
                        "type": "**",
                        "release": "patch"
                    }
                ]
            }
        ]
    ]
}
Pipeline logs
[semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merged PR 1135: PR with no description
[semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merged PR 1134: Another PR

With a description
[semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 2 commits complete: patch release
Workaround

Issue #339 has a workaround, which is to specify one rule without a subject, message, tag or type:

"release": {
    "plugins": [
        [
            "@semantic-release/commit-analyzer",
            {
                "preset": "angular",
                "releaseRules": [
                    {
                        "release": "patch"
                    }
                ]
            }
        ]
    ]
}

This works with and without PR descriptions present, however commits starting with feat: no longer increment the minor version:

[semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: feat: Another PR
[semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
[semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 1 commits complete: patch release
Package Versions
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^10.0.1",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/npm": "^10.0.4",
"@semantic-release/release-notes-generator": "^11.0.4",
"semantic-release": "^22.0.5"

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 by reproducing the custom releaseRules configuration with commits containing and omitting a pull request description, using the pipeline logs as the expected comparison. Trace how multiline commit messages are matched against subject, message, tag, and type rules. Done means custom rules consistently trigger the intended patch release while feat: commits retain their minor-release behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
release
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.