Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 reusing ReleaseNotes._instance breaks monorepo package-specific commits #78

Open
scottnath opened this issue Sep 6, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@scottnath
Copy link

Hi @momocow

I love this plugin and using emojis instead of angular commit msgs, so thank you!

I'm seeing a bug when using a monorepo where ReleaseNotes' knowledge of commits persists when semantic-release is iterating across packages in a monorepo. Whichever package is first, the commits related to that package are the only commits listed for all subsequent packages.

Example repo: https://github.com/scottnath/experiments

Monorepo plugin: https://github.com/qiwi/multi-semantic-release

The fix I found

The ReleaseNotes class .get reuses the ._instance instead of using the current set of commits it should be receiving. I was able to make the monorepo packages have separate release notes by having .get freshly instantiate the class each time:

see the change: scottnath/semantic-release-gitmoji@main...release-notes-class

  static get (context, releaseNotesOptions) {
    ReleaseNotes._instance = new ReleaseNotes(context, releaseNotesOptions)
    return ReleaseNotes._instance
  }

I don't know if this is a valid fix because I'm not sure what use case(s) exist for not using the class with new, but figured it would be a good place to start to find a final fix.

Using current semantic-release-gitmoji

The dependencies:

  "dependencies": {
    "@qiwi/multi-semantic-release": "^7.0.0",
    "semantic-release": "^21.1.1",
    "semantic-release-gitmoji": "v1.6.4"
  }

example PR: scottnath/experiments#1
Release output in GitHub Actions: https://github.com/scottnath/experiments/actions/runs/6100581263/job/16555183681

Release Notes for package scottnath-experiment-a

# v0.1.0-add-release.1 (https://github.com/scottnath/experiments/compare/scottnath-experiments-a@0.0.2-add-release.1...scottnath-experiments-a@0.1.0-add-release.1) (2023-09-06)

## ✨ New Features

    * 67f2e78 (https://github.com/scottnath/experiments/commit/67f2e78) ✨ another change in A

## 🐛 Fixes

    * fd83f3d (https://github.com/scottnath/experiments/commit/fd83f3d) 🆕 change to A

Release notes for package scottnath-experiment-b

# v0.1.0-add-release.1 (https://github.com/scottnath/experiments/compare/scottnath-experiments-b@0.0.2-add-release.1...scottnath-experiments-b@0.1.0-add-release.1) (2023-09-06)

## ✨ New Features

    * 67f2e78 (https://github.com/scottnath/experiments/commit/67f2e78) ✨ another change in A

## 🐛 Fixes

    * fd[83](https://github.com/scottnath/experiments/actions/runs/6100581263/job/16555183681#step:6:84)f3d (https://github.com/scottnath/experiments/commit/fd83f3d) 🆕 change to A

### Dependencies

    * scottnath-experiments-a: upgraded to 0.1.0-add-release.1

Using the adjusted package at scottnath/semantic-release-gitmoji

scottnath/semantic-release-gitmoji@main...release-notes-class

The dependencies:

  "dependencies": {
    "@qiwi/multi-semantic-release": "^7.0.0",
    "semantic-release": "^21.1.1",
    "semantic-release-gitmoji": "github:scottnath/semantic-release-gitmoji#release-notes-class"
  }

example PR: scottnath/experiments#2
Release output in GitHub Actions: https://github.com/scottnath/experiments/actions/runs/6100581263/job/16555183681

Release Notes for package scottnath-experiment-a

# v0.1.0-add-release-experiment.1 (https://github.com/scottnath/experiments/compare/[email protected]@0.1.0-add-release-experiment.1) (2023-09-06)

## ✨ New Features

    * 67f2e78 (https://github.com/scottnath/experiments/commit/67f2e78) ✨ another change in A

## 🐛 Fixes

    * a3349cb (https://github.com/scottnath/experiments/commit/a3349cb) 🐛 add basic files to packages 
    * 2c1d02a (https://github.com/scottnath/experiments/commit/2c1d02a) 🐛 changes to b 
    * af83eca (https://github.com/scottnath/experiments/commit/af83eca) 🐛 only in a 
    * bfbfadb (https://github.com/scottnath/experiments/commit/bfbfadb) 🐛 change in A 
    * 9ef89fc (https://github.com/scottnath/experiments/commit/9ef89fc) 🚀 set up one pkg fully 
    * 4eb481b (https://github.com/scottnath/experiments/commit/4eb481b) 🎨 changes to A only 
    * fd83f3d (https://github.com/scottnath/experiments/commit/fd83f3d) 🆕 change to A

Release notes for package scottnath-experiment-b

# v0.0.2-add-release-experiment.1 (https://github.com/scottnath/experiments/compare/[email protected]@0.0.2-add-release-experiment.1) (2023-09-06)

## 🐛 Fixes

    * a3349cb (https://github.com/scottnath/experiments/commit/a3349cb) 🐛 add basic files to packages 
    * 2c1d02a (https://github.com/scottnath/experiments/commit/2c1d02a) 🐛 changes to b 
    * 56cf3f9 (https://github.com/scottnath/experiments/commit/56cf3f9) 🐛 change to B 
    * b6ea03a (https://github.com/scottnath/experiments/commit/b6ea03a) 🐛 change in B 
    * 9ef[89](https://github.com/scottnath/experiments/actions/runs/6101134859/job/16556837347#step:6:90)fc (https://github.com/scottnath/experiments/commit/9ef89fc) 🚀 set up one pkg fully 
    * 2673e5c (https://github.com/scottnath/experiments/commit/2673e5c) 🚀 fixing tagformat in b 
    * ecc71ca (https://github.com/scottnath/experiments/commit/ecc71ca) 🎨 changes to B only

### Dependencies

    * scottnath-experiments-a: upgraded to 0.1.0-add-release-experiment.1

thank you for any help!

@momocow momocow added the enhancement New feature or request label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants