semantic-release / commit-analyzer

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

Can't find a release from commits #118

Closed erodewald closed 5 years ago

erodewald commented 5 years ago

I'm having trouble convincing my configuration to see release-worthy commits. I have included a snippet from numerous attempts I've tried:

[2:41:56 AM] [semantic-release] › ℹ  No git tag version found
[2:41:56 AM] [semantic-release] › ℹ  No previous release found, retrieving all commits
[2:41:56 AM] [semantic-release] › ℹ  Found 21 commits since last release
[2:41:56 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge pull request #6 from erodewald/base-features

feat: new feature (ci test)
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: feat: new feature (ci test)

[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge pull request #5 from erodewald/base-features

feat: Remove emoji commit
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: feat: Remove emoji commit
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge pull request #4 from erodewald/base-features

:sparkles: feat: Add PR template
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: :sparkles: feat: Add PR template
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge pull request #3 from erodewald/base-features

At some point in the above, I abandoned emoji prefixes because I thought it might be messing up the analyzer. No dice.

package.json:

{
  "scripts": {
    "semantic-release": "semantic-release -e ./config/release.config.js"
  },
  "devDependencies": {
    "conventional-changelog-angular": "~5.0.3",
    "semantic-git-commit-cli": "3.1.1",
    "semantic-release": "^15.13.3",
    "sr-commit-analyzer": "^2.0.3",
    "sr-release-notes-generator": "^1.1.3",
  },
  "sgc": {
    "emoji": false,
    "lowercaseTypes": true,
    "rules": {
      "endWithDot": false
    }
  }
}

config/release.config.js:

module.exports = {
  preset: 'angular',
  analyzeCommits: {
    parserOpts: {
      // Optional, only you want to have emoji commit support
      headerPattern: /^(?::([\w-]*):)?\s*(\w*):\s*(.*)$/,
      headerCorrespondence: ['emoji', 'tag', 'message']
    }
  },
  generateNotes: {
    parserOpts: {
      // Optional, only you want to have emoji commit support
      headerPattern: /^(?::([\w-]*):)?\s*(\w*):\s*(.*)$/,
      headerCorrespondence: ['emoji', 'tag', 'message']
    }
  }
}

I'm sure I have misconfigured it, but I'm just not seeing what's tripping up the commit analyzer. Help would be great :)

pvdlg commented 5 years ago

As you can see in the documentation, the plugin use by default the release rules from default-release-rules.js.

Your commit with an Emoji do not match any release rule (there is no rule for :sparkles:).

Your other commits do not match the Angular convention not the regex you configured. Your commit subject is supposed to be feat: Remove emoji commit but instead you put that in the body and the subject is Merge pull request #4 from erodewald/base-features.

erodewald commented 5 years ago

Your commit subject is supposed to be feat: Remove emoji commit but instead you put that in the body and the subject is Merge pull request #4 from erodewald/base-features.

I didn't expect the merge commits to trigger a release, but I did expect the following commit to trigger:

[2:41:56 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: feat: new feature (ci test)

That's a subject-only commit with no emoji prefix.