question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Customize generateNotes configuration

See original GitHub issue

We 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:closed
  • Created 4 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pmowrercommented, Mar 26, 2020

It’s most likely a bug with this library… I’ll dig into it!

1reaction
elizabethsjuddcommented, Apr 10, 2020

That did the trick @pmowrer. Thank you so much for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Question: configuration for custom settings commit-analyzer ...
Configuring generateNotes is the old way of configuring plugins. The new way is to use plugins . You config in plugin override others...
Read more >
Plugins - semantic-release - GitBook
generateNotes : Generate release notes for the commits added since the last ... and the validity of the GitHub authentication and release configuration....
Read more >
How create DOLS offline configuration to generate Notes ID ...
1) Open the doladmin.nsf on the Domino server. 2) Create a new security policy by clicking "New Security Policy". 4) In the Basics...
Read more >
sr-release-notes-generator - npm
Customizable release-notes-generator plugin for semantic-release. ... Set the generateNotes plugin for semantic-release in package.json .
Read more >
semantic-release/semantic-release - Gitter
and I'm trying to configure semantic-release so it can parse my commit message new format ... I need to add it in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found