Skip to content

Providing a PR description breaks custom releaseRules #535

Open
@MBR41

Description

@MBR41

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions