Skip to content

Cannot read property 'name' of undefined #285

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

Closed
maxime1992 opened this issue Sep 13, 2020 · 5 comments
Closed

Cannot read property 'name' of undefined #285

maxime1992 opened this issue Sep 13, 2020 · 5 comments

Comments

@maxime1992
Copy link

Hi, I'm trying to setup a pre release for a given branch and I'm facing the same issue as semantic-release/git#185.

See the last command of the travis job here: https://travis-ci.org/github/cloudnc/ngx-sub-form/builds/726664320

[10:34:50 PM] [semantic-release] › ℹ Start step "fail" of plugin "@semantic-release/github" [10:34:50 PM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication [10:34:51 PM] [semantic-release] › ✖ Failed step "fail" of plugin "@semantic-release/github" [10:34:51 PM] [semantic-release] › ✖ An error occurred while running semantic-release: TypeError: Cannot read property 'name' of undefined at module.exports (/home/travis/build/cloudnc/ngx-sub-form/node_modules/@semantic-release/github/lib/get-fail-comment.js:17:10) at module.exports (/home/travis/build/cloudnc/ngx-sub-form/node_modules/@semantic-release/github/lib/fail.js:28:74) at async fail (/home/travis/build/cloudnc/ngx-sub-form/node_modules/@semantic-release/github/index.js:64:3) at async validator (/home/travis/build/cloudnc/ngx-sub-form/node_modules/semantic-release/lib/plugins/normalize.js:34:24) at async /home/travis/build/cloudnc/ngx-sub-form/node_modules/semantic-release/lib/plugins/pipeline.js:37:34 at async /home/travis/build/cloudnc/ngx-sub-form/node_modules/semantic-release/lib/plugins/pipeline.js:31:3 at async Object.pluginsConf. [as fail] (/home/travis/build/cloudnc/ngx-sub-form/node_modules/semantic-release/lib/plugins/index.js:80:11) at async callFail (/home/travis/build/cloudnc/ngx-sub-form/node_modules/semantic-release/index.js:235:7) at async module.exports (/home/travis/build/cloudnc/ngx-sub-form/node_modules/semantic-release/index.js:264:7) at async module.exports (/home/travis/build/cloudnc/ngx-sub-form/node_modules/semantic-release/cli.js:55:5) { pluginName: '@semantic-release/github' } [10:34:51 PM] [semantic-release] › ✖ EPRERELEASEBRANCH A pre-release branch configuration is invalid in the `branches` configuration. Each pre-release branch in the branches configuration (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#branches) must have a prerelease property valid per the Semantic Versioning Specification (https://semver.org/#spec-item-9). If the prerelease property is set to true, then the name property is used instead.

I did upgrade semantic-release to latest (17.1.1):

cloudnc/ngx-sub-form@12d12b3

And I'm trying to setup a pre release branch with the following:

cloudnc/ngx-sub-form@1e2a3fd

{
  "pkgRoot": "dist/ngx-sub-form",
  "branches": [
    "master",
    {
      "name": "feat/rewrite",
      "channel": "beta-rewrite",
      "prerelease": true
    }
  ]
}

Am I missing something?

@travi
Copy link
Member

travi commented Sep 13, 2020

EPRERELEASEBRANCH A pre-release branch configuration is invalid in the branches configuration. Each pre-release branch in the branches configuration (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#branches) must have a prerelease property valid per the Semantic Versioning Specification (https://semver.org/#spec-item-9). If the prerelease property is set to true, then the name property is used instead.

Your name contains a /, which is invalid in a pre-release identifier according to https://semver.org/#spec-item-9

@maxime1992
Copy link
Author

maxime1992 commented Sep 13, 2020

@travi thanks for having a look 😊

I looked into this before I posted the issue but I think I may be missing something. I thought the name property was to target a branch and the channel was to let say "rename" it to whatever we want in the version. Is that not correct?

What is channel for exactly then?

Here https://github.com/semantic-release/semantic-release/blob/master/docs/usage/workflow-configuration.md it says

The distribution channel on which to publish releases from this branch. Set to false to force the default distribution channel instead of using the default. See channel.

I'm not sure to understand what that mean and could be missing something obvious 👼

@travi
Copy link
Member

travi commented Sep 14, 2020

What is channel for exactly then?

npm dist-tags are used to define the distribution channels, which you can learn more about here: https://docs.npmjs.com/adding-dist-tags-to-packages. channel defines the dist tag to be used when publishing from this branch.

@maxime1992
Copy link
Author

maxime1992 commented Sep 14, 2020

Renaming the branch worked indeed.

I'm going to go ahead and close this issue but I think there should be a way to map a branch name to something else so that any branch can be deployed as long as we override the name :)

Thanks for the help @travi 🙏 !

@travi
Copy link
Member

travi commented Sep 26, 2020

i happened to be reading the details of the prerelease property a bit more closely today and found a detail that i think would help in this situation, if i understand your goal correctly.

you should be able to use the name property to match your branch name, even if it contains characters that are invalid in a pre-release identifier, and then use the prerelease property to define the actual pre-release identifier that should be used.

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

2 participants