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

Why $package_name is not define automatically? #119

Open
Thenkei opened this issue Mar 28, 2024 · 1 comment
Open

Why $package_name is not define automatically? #119

Thenkei opened this issue Mar 28, 2024 · 1 comment

Comments

@Thenkei
Copy link

Thenkei commented Mar 28, 2024

Hello 👋

I'm a little bit confused with the indication in the documentation and the reality.

Here's the description of packageName.

Option Description Default
packageName Override or add package name instead of npm package name SEMANTIC_RELEASE_PACKAGE or npm package name

In my case, I want the default behavior. For some reason, I get an error yelling at me:
A name for the package must be created. Run through npm (npm run <semantic-release-script> to use npm package name or define packageName in the plugin config or SEMANTIC_RELEASE_PACKAGE in the environment

https://github.com/juliuscc/semantic-release-slack-bot/blob/214aef05f05a6f79e6c437245bb592b83d3f8844/lib/verifyConditions.js#L34C3-L47C4

So I am confused, I just want the default package name without any override.

(We use the plugin within a mono repo setup with multi-semantic-release, could this lead to a different behavior?)

@Thenkei
Copy link
Author

Thenkei commented Mar 28, 2024

After some deeper investigation it's related to multi-semantic-release that doesn't provide packageName within pluginConfig but a property name instead..

I came up with a trick doing the job in our case using the $release_notes that already include the actual package released.

[
      'semantic-release-slack-bot',
      {
        markdownReleaseNotes: true,
        notifyOnSuccess: true,
        notifyOnFail: false,
        onSuccessTemplate: {
          text: 'A new ($npm_package_name@$npm_package_version) has been released!',
          blocks: [
            {
              type: 'section',
              text: {
                type: 'mrkdwn',
                text: '*Changes* of version $release_notes',
              },
            },
          ],
        },
        packageName: 'whatever',
      },
    ],

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