semantic-release / commit-analyzer

:bulb: semantic-release plugin to analyze commits with conventional-changelog
MIT License
358 stars 73 forks source link

`The commit should not trigger a release` after recent updates #642

Open ashvardanian opened 2 months ago

ashvardanian commented 2 months ago

My commit messages look like these:

commit d2b67fb4df02293e0a6478ffa6b61a1d6c502cff (origin/main-dev)
Author: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>
Date:   Mon May 6 00:55:26 2024 +0000

    Fix: Build graph dependency

commit 4168fcda53a75eb50bde9cd342aa42eebf253422 (main-dev)
Author: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>
Date:   Sun May 5 06:15:13 2024 +0000

    Make: Refresh `Cargo.lock`

... and the .releaserc is configured to detect those:

    "plugins": [
        [
            "@semantic-release/commit-analyzer",
            {
                "preset": "eslint",
                "releaseRules": [
                    {
                        "tag": "Break",
                        "release": "major"
                    },
                    {
                        "tag": "Add",
                        "release": "minor"
                    },
                    {
                        "tag": "Improve",
                        "release": "patch"
                    },
                    {
                        "tag": "Make",
                        "release": "patch"
                    },
                    {
                        "tag": "Refactor",
                        "release": false
                    }
                ]
            }
        ],

But recently, all of the semantic-release pipelines simply ignore all the releases:

[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Make: Publish Python sources
Closes #113
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge pull request #117 from ashvardanian/main-dev
Linking OpenMP
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Make: Disable JS prebuild for Windows

I'm currently using semantic-release in several projects and can't run the CI without it. I've tried locating the issue, but couldn't find where its coming from. Any pointers you could share?

travi commented 2 months ago

Possibly related to https://github.com/semantic-release/release-notes-generator/issues/633

HenrikPoulsen commented 2 months ago

Why doesn't the commit-analyzer throw an error in this situation? I also had issues with it, in my case I was trying to get the breaking change feat! syntax working. The commit analyzer just ignored them, so I assume it just silently falls back to the angular preset or something? Would have saved me many hours if it actually hard failed

HenrikPoulsen commented 1 month ago

I raised it over in https://github.com/semantic-release/release-notes-generator/issues/633 as well, but I think it makes sense here as well. Updating the plugins seems like an inherently dangerous proposition when it comes to semantic-release. How am I supposed to know when an update is breaking the entire release flow like in the case outlined here? As you can see from the output there's no errors at all. So you could go week after updating something without noticing anything is wrong. We at least saw that the release-notes-generator broke from this change, but the commit-analyzer doesn't even get that far if you do what was outlined in this issue here.

Are there any suggestions for how one could automate verifying that an update doesn't break something? (even a non-major version update could still break you) How would you, in your update branch, verify automatically that things like a feat!, fix or whatever else would still want to bump? Are there things that could be done in semantic release itself to help reduce this?

If you are just doing this in a single repo it's not so much of a problem. But in my case I am considering rolling it out across hundreds of repos, specifically with the conventionalcommits plugin. I don't know how to do this successfully given issues like this being able to arise.

Yelinz commented 1 month ago

Im on latest for all the packages. semantic-release v24, commit-analyzer v13, release-note-generator v14 (which does not fix this problem) But the analyzer does not classify fix(i18n): add missing translation for de as something that needs releasing.

IMO this problem is unrelated to the one mentioned in release-note-generator.

travi commented 1 month ago

are you using commitlint as well? if so, see https://github.com/semantic-release/release-notes-generator/issues/660#issuecomment-2154972720

what does npm ls conventional-changelog-conventionalcommits give you?

Yelinz commented 1 month ago

Yes, I added a resolution to pin conventional-changelog-conventionalcommits to 8 as it was previously 7. But even after the pinning, no release gets triggered by the previously mentioned commit.

The used semantic release config uses the defaults, so it should use the angular preset. It is similar enough to conventionalcommits, that we had no problems until now. Therefore even tough commitlint is installed it should not matter. The angular preset is not directly installed, I assume that could cause probems?

One thing to mention as well is that the releases work for the config repository. But a repo that uses the config does not release.

EDIT: Seems like the Issue was caused by the commit being a compound message. Disgregard what I was saying. Just a stupid user error. Sorry for the wasted time

Saw that you mentioned yarn, the project uses pnpm.

pnpm why output

conventional-changelog-conventionalcommits ```sh yz@forest:~/repos/ember-alexandria$ pnpm why conventional-changelog-conventionalcommits devDependencies: @adfinis/semantic-release-config 5.0.0 └─┬ @commitlint/config-conventional 19.2.2 └── conventional-changelog-conventionalcommits 8.0.0 ``` conventional-changelog-angular ```sh @adfinis/semantic-release-config 5.0.0 ├─┬ @commitlint/cli 19.3.0 │ └─┬ @commitlint/lint 19.2.2 │ └─┬ @commitlint/parse 19.0.3 │ └── conventional-changelog-angular 7.0.0 ├─┬ @semantic-release/changelog 6.0.3 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/commit-analyzer 13.0.0 │ │ └── conventional-changelog-angular 8.0.0 │ └─┬ @semantic-release/release-notes-generator 14.0.0 │ └── conventional-changelog-angular 8.0.0 ├─┬ @semantic-release/commit-analyzer 13.0.0 │ └── conventional-changelog-angular 8.0.0 ├─┬ @semantic-release/git 10.0.1 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/commit-analyzer 13.0.0 │ │ └── conventional-changelog-angular 8.0.0 │ └─┬ @semantic-release/release-notes-generator 14.0.0 │ └── conventional-changelog-angular 8.0.0 ├─┬ @semantic-release/github 10.0.6 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/commit-analyzer 13.0.0 │ │ └── conventional-changelog-angular 8.0.0 │ └─┬ @semantic-release/release-notes-generator 14.0.0 │ └── conventional-changelog-angular 8.0.0 ├─┬ @semantic-release/npm 12.0.1 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/commit-analyzer 13.0.0 │ │ └── conventional-changelog-angular 8.0.0 │ └─┬ @semantic-release/release-notes-generator 14.0.0 │ └── conventional-changelog-angular 8.0.0 ├─┬ @semantic-release/release-notes-generator 14.0.0 │ └── conventional-changelog-angular 8.0.0 └─┬ semantic-release 24.0.0 ├─┬ @semantic-release/commit-analyzer 13.0.0 │ └── conventional-changelog-angular 8.0.0 └─┬ @semantic-release/release-notes-generator 14.0.0 └── conventional-changelog-angular 8.0.0 semantic-release 24.0.0 ├─┬ @semantic-release/commit-analyzer 13.0.0 │ └── conventional-changelog-angular 8.0.0 └─┬ @semantic-release/release-notes-generator 14.0.0 └── conventional-changelog-angular 8.0.0 ``` @semantic-release/release-notes-generator ```sh yz@forest:~/repos/ember-alexandria$ pnpm why @semantic-release/release-notes-generator devDependencies: @adfinis/semantic-release-config 5.0.0 ├─┬ @semantic-release/changelog 6.0.3 │ └─┬ semantic-release 24.0.0 peer │ └── @semantic-release/release-notes-generator 14.0.0 ├─┬ @semantic-release/git 10.0.1 │ └─┬ semantic-release 24.0.0 peer │ └── @semantic-release/release-notes-generator 14.0.0 ├─┬ @semantic-release/github 10.0.6 │ └─┬ semantic-release 24.0.0 peer │ └── @semantic-release/release-notes-generator 14.0.0 ├─┬ @semantic-release/npm 12.0.1 │ └─┬ semantic-release 24.0.0 peer │ └── @semantic-release/release-notes-generator 14.0.0 ├── @semantic-release/release-notes-generator 14.0.0 └─┬ semantic-release 24.0.0 └── @semantic-release/release-notes-generator 14.0.0 semantic-release 24.0.0 └── @semantic-release/release-notes-generator 14.0.0 ``` @semantic-release/commit-analyzer ```sh yz@forest:~/repos/ember-alexandria$ pnpm why @semantic-release/commit-analyzer devDependencies: @adfinis/semantic-release-config 5.0.0 ├─┬ @semantic-release/changelog 6.0.3 │ └─┬ semantic-release 24.0.0 peer │ └── @semantic-release/commit-analyzer 13.0.0 ├── @semantic-release/commit-analyzer 13.0.0 ├─┬ @semantic-release/git 10.0.1 │ └─┬ semantic-release 24.0.0 peer │ └── @semantic-release/commit-analyzer 13.0.0 ├─┬ @semantic-release/github 10.0.6 │ └─┬ semantic-release 24.0.0 peer │ └── @semantic-release/commit-analyzer 13.0.0 ├─┬ @semantic-release/npm 12.0.1 │ └─┬ semantic-release 24.0.0 peer │ └── @semantic-release/commit-analyzer 13.0.0 └─┬ semantic-release 24.0.0 └── @semantic-release/commit-analyzer 13.0.0 semantic-release 24.0.0 └── @semantic-release/commit-analyzer 13.0.0 ``` semantic-release ```sh yz@forest:~/repos/ember-alexandria$ pnpm why semantic-release devDependencies: @adfinis/semantic-release-config 5.0.0 ├─┬ @semantic-release/changelog 6.0.3 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/commit-analyzer 13.0.0 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/github 10.0.2 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/npm 12.0.0 │ │ └── semantic-release 24.0.0 peer │ └─┬ @semantic-release/release-notes-generator 14.0.0 │ └── semantic-release 24.0.0 peer ├─┬ @semantic-release/commit-analyzer 13.0.0 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/github 10.0.2 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/npm 12.0.0 │ │ └── semantic-release 24.0.0 peer │ └─┬ @semantic-release/release-notes-generator 14.0.0 │ └── semantic-release 24.0.0 peer ├─┬ @semantic-release/git 10.0.1 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/commit-analyzer 13.0.0 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/github 10.0.2 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/npm 12.0.0 │ │ └── semantic-release 24.0.0 peer │ └─┬ @semantic-release/release-notes-generator 14.0.0 │ └── semantic-release 24.0.0 peer ├─┬ @semantic-release/github 10.0.6 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/commit-analyzer 13.0.0 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/github 10.0.2 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/npm 12.0.0 │ │ └── semantic-release 24.0.0 peer │ └─┬ @semantic-release/release-notes-generator 14.0.0 │ └── semantic-release 24.0.0 peer ├─┬ @semantic-release/npm 12.0.1 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/commit-analyzer 13.0.0 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/github 10.0.2 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/npm 12.0.0 │ │ └── semantic-release 24.0.0 peer │ └─┬ @semantic-release/release-notes-generator 14.0.0 │ └── semantic-release 24.0.0 peer ├─┬ @semantic-release/release-notes-generator 14.0.0 │ └─┬ semantic-release 24.0.0 peer │ ├─┬ @semantic-release/commit-analyzer 13.0.0 │ │ └── semantic-release 24.0.0 peer │ ├─┬ @semantic-release/github 10.0.2 │ │ └── semantic-release 24.0.0 peer │ └─┬ @semantic-release/npm 12.0.0 │ └── semantic-release 24.0.0 peer └─┬ semantic-release 24.0.0 ├─┬ @semantic-release/commit-analyzer 13.0.0 │ └── semantic-release 24.0.0 peer ├─┬ @semantic-release/github 10.0.2 │ └── semantic-release 24.0.0 peer ├─┬ @semantic-release/npm 12.0.0 │ └── semantic-release 24.0.0 peer └─┬ @semantic-release/release-notes-generator 14.0.0 └── semantic-release 24.0.0 peer semantic-release 24.0.0 ├─┬ @semantic-release/commit-analyzer 13.0.0 │ └── semantic-release 24.0.0 peer ├─┬ @semantic-release/github 10.0.2 │ └── semantic-release 24.0.0 peer ├─┬ @semantic-release/npm 12.0.0 │ └── semantic-release 24.0.0 peer └─┬ @semantic-release/release-notes-generator 14.0.0 └── semantic-release 24.0.0 peer ```

cgmEdi commented 2 weeks ago

Hi,

we have a similar issue but for us the releases are skipped if we use a release config that analyzes the "message"field:

  releaseRules: [
    { breaking: true, release: 'major' },
    { type: 'feat', release: 'minor' },
    { type: 'fix', release: 'patch' },
    { message: '*', release: 'patch' }
  ]
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge branch 'renovate/cgm-life.docker.artifactory.cgm.ag-automation-maven-1.x' into 'main'
chore(renovate): Update cgm-life.docker.artifactory.cgm.ag/automation/maven Docker tag to v1.8.4
See merge request cgm-de-life-infrastructure/kubernetes/automation-tools/pipeline-container-images/maven-jdk17!3
2024-07-02T07:09:11.404Z semantic-release:commit-analyzer Analyzing with custom rules
2024-07-02T07:09:11.406Z semantic-release:commit-analyzer Analyzing with default rules
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore(renovate): Update cgm-life.docker.artifactory.cgm.ag/automation/maven Docker tag to v1.8.4
2024-07-02T07:09:11.406Z semantic-release:commit-analyzer Analyzing with custom rules
2024-07-02T07:09:11.408Z semantic-release:commit-analyzer Analyzing with default rules
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge branch 'renovate/cgm-life.docker.artifactory.cgm.ag-automation-maven-1.x' into 'main'
chore(renovate): Update cgm-life.docker.artifactory.cgm.ag/automation/maven Docker tag to v1.8.3
See merge request cgm-de-life-infrastructure/kubernetes/automation-tools/pipeline-container-images/maven-jdk17!2
2024-07-02T07:09:11.409Z semantic-release:commit-analyzer Analyzing with custom rules
2024-07-02T07:09:11.409Z semantic-release:commit-analyzer Analyzing with default rules
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore(renovate): Update cgm-life.docker.artifactory.cgm.ag/automation/maven Docker tag to v1.8.3
2024-07-02T07:09:11.409Z semantic-release:commit-analyzer Analyzing with custom rules
2024-07-02T07:09:11.410Z semantic-release:commit-analyzer Analyzing with default rules
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 4 commits complete: no release
[7:09:11 AM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[7:09:11 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/exec"
[7:09:11 AM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/exec"
[7:09:11 AM] [semantic-release] › ℹ  There are no relevant changes, so no new version is released.

Commits with type fix or feat work as expected.

rj-wowza commented 1 week ago

Branches where there the branch name is capitalized are skipped:

[@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Fix: [LIVE-735] Remove feature flag for facebook live 
[@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release

it works if the branch name is lowercase like: fix: [LIVE-735] Remove feature flag for facebook live

this is problematic since Github capitalizes the branch names automatically

travi commented 1 week ago

Branches where there the branch name is capitalized are skipped

Branches commits with initial capitalization do not follow the commit convention you have chosen (even if you are using the default configured for semantic-release). semantic-release does not define the conventions and you have the option to define your own.

also, semantic-release evaluates commit messages, not branch names. this has not changed in recent updates

this is problematic since Github capitalizes the branch names automatically

if you are making commits through your browser, capitalizing the first letter of the branch name commit message field is browser behavior that you simply need to be careful about