Generate release notes with customized issue prefixes and url format when using Semantic release

Generate release notes with customized issue prefixes and url format when using Semantic release

·

1 min read

When trying to generate release notes with semantic-release, it is assuming you are using the angular commit message format.

It expects your commit messages are using # as the issue prefix format and referencing the issue URL ${YOUR_REPO_BASE_URL}/issues/${ISSUE_NUMBER_AFTER '#'}

So as an example, if you have Fix #12 in your commit message. Your release note would generate a link like this

Fix #12.

In case you are using Azure DevOps or Jira for issue tracking, you can customize the semantic release config as below:

Steps

  1. Create a .releaserc in the project root directory

  2. Put in below content

{  
  "plugins": [  
    ["@semantic-release/commit-analyzer", {  
      "preset": "conventionalcommits"  
    }],  
    ["@semantic-release/release-notes-generator", {  
      "preset": "conventionalcommits",  
      "presetConfig": {  
        "issuePrefixes": ['AB#'],  
        "issueUrlFormat": 'https://dev.azure.com/${REPLACE_WITH_ORGANIZATION_NAME}/${REPLACE_WITH_PROJECT_NAME}/_workitems/edit/{{id}}'  
      }  
    }],  
    "@semantic-release/npm",  
    "@semantic-release/github",  
  ]  
}

The above is an example for Azure DevOps, in case you have a different issue prefix and URL, update the issuePrefixes and issueUrlFormat under presetConfig

Important Note: be aware that it is a must to use "preset": "conventionalcommits" instead if "preset": "angular", check out the issue here

presetConfig not effecting anything · Issue #184 · semantic-release/release-notes-generator
*I've got a repo where i test and explore semantic-release plugins before they go into production repos. Recently spent…*
github.com

Happy Automation!