commit-analyzer icon indicating copy to clipboard operation
commit-analyzer copied to clipboard

Providing a PR description breaks custom releaseRules

Open MBR41 opened this issue 1 year ago • 1 comments

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"

MBR41 avatar Sep 26 '23 01:09 MBR41

have you tried adding body:"**"

httran13 avatar Dec 06 '23 16:12 httran13