1

I have teams I work with that love semantic-release, but often developers forget to put the commit message keywords in (e.g. fix, feat, perf). I understand this is something we need to hammer home or implement a pre-commit hook to require it. https://semantic-release.gitbook.io/semantic-release/#commit-message-format

Is there any way to configure semantic-release to ALWAYS increment my patch version number if no special commit keywords are provided in the PR merge or commit push to the branches I'm monitoring with semantic-release.

Example: Team branches off of main creating feature-branch-a and iterates for a day with some small changes. They create PR-1 pull request for said branch. They forgot to include commit keywords (fix, feat, perf, etc) and they then merge the PR into main. Semantic-release runs against the main branch and does not cut a new version... I want to be able to tell semantic-release to at least always increment the patch version, and create a github release.

I've tried the below config with no success:

{
    "branches": [
      "main", 
      {"name": "dev", "prerelease": true}
    ], 
    "plugins": [
      ["@semantic-release/commit-analyzer", {
        "preset": "angular",
        "releaseRules": [
          {
            "subject": "*",
            "release": "patch"
          },
          {
            "subject": "fix*",
            "release": "patch"
          },
          {
            "subject": "feat*",
            "release": "minor"
          },
          {
            "subject": "perf*",
            "release": "major"
          }
        ]
      }],
      
      "@semantic-release/release-notes-generator",
      [
        "@semantic-release/github"
      ]
    ]
  }

Log output (no new version with patch bumped):

[5:00:26 PM] [semantic-release] › ℹ  Found git tag v1.2.3 associated with version 1.2.3 on branch main
[5:00:26 PM] [semantic-release] › ℹ  Found 2 commits since last release
[5:00:26 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[5:00:26 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: test
[5:00:26 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:00:26 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: test
[5:00:26 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:00:26 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 2 commits complete: no release
[5:00:26 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[5:00:26 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/exec"
[5:00:26 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/exec"
[5:00:26 PM] [semantic-release] › ℹ  There are no relevant changes, so no new version is released.

UPDATE: figured out how to do it via this issue - https://github.com/semantic-release/semantic-release/discussions/1819

Thanks!

drewster
  • 61
  • 6

1 Answers1

0

https://github.com/semantic-release/semantic-release/discussions/1819

{"message": "*", "release": "patch"}

drewster
  • 61
  • 6