Skip to content

TypeError: Method Date.prototype.toString called on incompatible receiver #239

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

Open
hasezoey opened this issue Mar 25, 2025 · 0 comments
Open

Comments

@hasezoey
Copy link

Describe the bug
This was a known issue in semantic-release it self (semantic-release/semantic-release#3571), but this github action, at least as of 0a51e81 (tag v4.2.0) still depends on [email protected] due to the package-lock.json:

"node_modules/conventional-changelog-writer": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-8.0.0.tgz",

Error:

[10:03:39 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[10:03:39 AM] [semantic-release] › ✘  Failed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[10:03:39 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/_actions/cycjimmy/semantic-release-action/0a51e81a6baff2acad3ee88f4121c589c73d0f0e/node_modules/conventional-changelog-writer/dist/utils.js:8:12)
    at defaultCommitTransform (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/0a51e81a6baff2acad3ee88f4121c589c73d0f0e/node_modules/conventional-changelog-writer/dist/options.js:23:23)
    at transformCommit (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/0a51e81a6baff2acad3ee88f4121c589c73d0f0e/node_modules/conventional-changelog-writer/dist/commit.js:29:23)
    at write (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/0a51e81a6baff2acad3ee88f4121c589c73d0f0e/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: TypeError: Method Date.prototype.toString called on incompatible receiver [object Date]

Workflow

- name: Semantic Release
  uses: cycjimmy/semantic-release-action@0a51e81a6baff2acad3ee88f4121c589c73d0f0e # v4.2.0
  with:
    # dry_run: true
    # plugins included in semantic-release by default:
    # @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/npm @semantic-release/github
    extra_plugins: |
      @semantic-release/[email protected]
      @semantic-release/[email protected]
      @commitlint/[email protected]
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Before the Workaround

As a workaround, [email protected] can be explicitly installed:

extra_plugins: |
  @semantic-release/[email protected]
  @semantic-release/[email protected]
  @commitlint/[email protected]
  [email protected]

Workaround Workflow file

Expected behavior
No Error to happen.

Additional context
This could be solved by either:

  • not shipping a package-lock.json in the action
  • updating conventional-changelog-writer in the lockfile to 8.0.1 (or explicitly depending on it)
  • waiting for semantic-release to update the dependency requirement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant