semantic-release / release-notes-generator

:clipboard: semantic-release plugin to generate changelog content with conventional-changelog
MIT License
298 stars 47 forks source link

TypeError: Method Date.prototype.toString called on incompatible receiver [object Date] #657

Closed Th3S4mur41 closed 1 month ago

Th3S4mur41 commented 1 month ago

After updating semantic-release to version 24.0.0, running semantic-release fails in multiple repositories with the following error:

[8:14:13 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[8:14:13 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 2 commits complete: patch release
[8:14:13 AM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[8:14:13 AM] [semantic-release] › ℹ  The next release version is 1.3.3
[8:14:13 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[8:14:13 AM] [semantic-release] › ✘  Failed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[8:14:13 AM] [semantic-release] › ✘  An error occurred while running semantic-release: TypeError: Method Date.prototype.toString called on incompatible receiver [object Date]
    at Proxy.toString (<anonymous>)
    at [Symbol.toPrimitive] (<anonymous>)
    at new Date (<anonymous>)
    at Object.formatDate (file:///home/runner/work/clean-self-hosted-runner/clean-self-hosted-runner/node_modules/conventional-changelog-writer/dist/utils.js:8:12)
    at defaultCommitTransform (file:///home/runner/work/clean-self-hosted-runner/clean-self-hosted-runner/node_modules/conventional-changelog-writer/dist/options.js:23:23)
    at transformCommit (file:///home/runner/work/clean-self-hosted-runner/clean-self-hosted-runner/node_modules/conventional-changelog-writer/dist/commit.js:29:23)
    at write (file:///home/runner/work/clean-self-hosted-runner/clean-self-hosted-runner/node_modules/conventional-changelog-writer/dist/writers.js:39:28)
    at async nextAsync (node:internal/streams/from:1[82](https://github.com/eviden-actions/clean-self-hosted-runner/actions/runs/9346616920/job/25721881145#step:5:83):33) {
  pluginName: '@semantic-release/release-notes-generator'
}
TypeError: Method Date.prototype.toString called on incompatible receiver [object Date]
    at Proxy.toString (<anonymous>)
    at [Symbol.toPrimitive] (<anonymous>)
    at new Date (<anonymous>)
    at Object.formatDate (file:///home/runner/work/clean-self-hosted-runner/clean-self-hosted-runner/node_modules/conventional-changelog-writer/dist/utils.js:8:12)
    at defaultCommitTransform (file:///home/runner/work/clean-self-hosted-runner/clean-self-hosted-runner/node_modules/conventional-changelog-writer/dist/options.js:23:23)
    at transformCommit (file:///home/runner/work/clean-self-hosted-runner/clean-self-hosted-runner/node_modules/conventional-changelog-writer/dist/commit.js:29:23)
    at write (file:///home/runner/work/clean-self-hosted-runner/clean-self-hosted-runner/node_modules/conventional-changelog-writer/dist/writers.js:39:28)
    at async nextAsync (node:internal/streams/from:182:33) {
  pluginName: '@semantic-release/release-notes-generator'
}
Error: Process completed with exit code 1.

This is happening with @semantic-release/release-notes-generator 14.0.0

I also tried to remove node_modules and package-lock.json and run a clean npm i, but the problem remains

Th3S4mur41 commented 1 month ago

Duplicate of https://github.com/semantic-release/release-notes-generator/issues/655

Issue solved by overriding conventional-changelog-conventionalcommits to v8 or higher

"overrides": {
  "conventional-changelog-conventionalcommits": ">= 8.0.0"
}

This should be solved automatically when the dependency is updated in @commitlint/config-conventional