Customize generateNotes configuration
See original GitHub issueWe are using semantic-release
and semantic-release-monorepo
in our project and want to modify the default conventional-changelog-angular
writerOpts
configuration (specifically the transform
function).
Following the guidelines for semantic release, I added the function at the root of the config object and my changes were applied to the changelog notes in GH.
module.exports = {
branches: ['master'],
githubUrl: 'https://github.ibm.com',
githubApiPathPrefix: 'api/v3',
releaseRules: [...],
generateNotes: {
preset: 'angular',
writerOpts: {
transform: (commit, context) => {...},
}
},
releaseNotes: {
issueResolution: {
template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
baseUrl: 'https://github.ibm.com',
source: 'github.ibm.com',
},
},
}
However, with this approach we lost the commit package scoping that is provided by semantic-release-monorepo
.
In a different project we use semantic-release-gitmoji
as our changelog convention and were able to set it up to work with semantic-release-monorepo
by doing the following:
module.exports = {
monorepo: {
analyzeCommits: 'semantic-release-gitmoji',
generateNotes: 'semantic-release-gitmoji',
},
branches: ['develop'],
githubUrl: 'https://github.ibm.com',
githubApiPathPrefix: 'api/v3',
releaseRules,
releaseNotes: {
template,
partials: {
commitTemplate,
emojiCommitsTemplate,
},
issueResolution: {
template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
baseUrl: 'https://github.ibm.com',
source: 'github.ibm.com',
},
},
};
I tried to do something similar in my current project:
module.exports = {
monorepo: {
generateNotes: {
preset: 'angular',
writerOpts: {
transform: (commit, context) => {...},
}
},
},
branches: ['master'],
githubUrl: 'https://github.ibm.com',
githubApiPathPrefix: 'api/v3',
releaseRules: [...],
releaseNotes: {
issueResolution: {
template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
baseUrl: 'https://github.ibm.com',
source: 'github.ibm.com',
},
},
}
but did not have any luck as it reverted back to using the default transform
function
Debug with generateNotes
in monorepo
:
options values: { branches:
[ 'master',
{ name: 'staging', prerelease: true } ],
repositoryUrl: 'git@github.ibm.com:liz-judd/semantic-release-testing.git',
tagFormat: '@whpal/liz-semrel-testing-utilities-v${version}',
plugins:
[ '@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/npm',
'@semantic-release/github' ],
analyzeCommits:
[ [AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction] ],
generateNotes:
[ [AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction] ],
monorepo:
{ generateNotes: { preset: 'angular', writerOpts: [Object] } },
githubUrl: 'https://github.ibm.com',
githubApiPathPrefix: 'api/v3',
releaseRules: [ ... ],
releaseNotes:
{ issueResolution:
{ template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
baseUrl: 'https://github.ibm.com',
source: 'github.ibm.com' } },
}
Debug with generateNotes
at root:
options values: { branches:
[ 'master',
{ name: 'staging', prerelease: true } ],
repositoryUrl: 'git@github.ibm.com:liz-judd/semantic-release-testing.git',
tagFormat: '@whpal/liz-semrel-testing-utilities-v${version}',
plugins:
[ '@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/npm',
'@semantic-release/github' ],
analyzeCommits:
[ [AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction],
[AsyncFunction] ],
generateNotes:
{ preset: 'angular',
writerOpts: { transform: [Function: transform] } },
githubUrl: 'https://github.ibm.com',
githubApiPathPrefix: 'api/v3',
releaseRules: [...],
releaseNotes:
{ issueResolution:
{ template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
baseUrl: 'https://github.ibm.com',
source: 'github.ibm.com' } },
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (7 by maintainers)
Top GitHub Comments
It’s most likely a bug with this library… I’ll dig into it!
That did the trick @pmowrer. Thank you so much for your help!