gitlab icon indicating copy to clipboard operation
gitlab copied to clipboard

labels cannot be disable as shown on README

Open MeNsaaH opened this issue 3 years ago • 2 comments

The docs say that to disable labels, set it to false. HOwever, on setting to false, it throws this error:

[7:01:31 PM] [semantic-release] › ✖  EINVALIDLABELS Invalid `labels` option.
The labels option (https://github.com/semantic-release/gitlab/blob/master/README.md#labels) if defined, must be a non empty String.
Your configuration for the labels option is false.
[7:01:31 PM] [semantic-release] › ✖  EINVALIDLABELS Invalid `labels` option.
The labels option (https://github.com/semantic-release/gitlab/blob/master/README.md#labels) if defined, must be a non empty String.
Your configuration for the labels option is false.
AggregateError: 
    SemanticReleaseError: Invalid `labels` option.
        at module.exports (/usr/local/lib/node_modules/@semantic-release/gitlab/lib/get-error.js:6:10)
        at /usr/local/lib/node_modules/@semantic-release/gitlab/lib/verify.js:43:31
        at Array.map (<anonymous>)
        at module.exports (/usr/local/lib/node_modules/@semantic-release/gitlab/lib/verify.js:43:6)
        at verifyConditions (/usr/local/lib/node_modules/@semantic-release/gitlab/index.js:11:9)
        at validator (/usr/local/lib/node_modules/semantic-release/lib/plugins/normalize.js:34:30)
        at /usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:37:40
        at next (/usr/local/lib/node_modules/semantic-release/node_modules/p-reduce/index.js:17:9)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:54:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async pluginsConf.<computed> [as verifyConditions] (/usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:80:11)
    at async run (/usr/local/lib/node_modules/semantic-release/index.js:103:3)
    at async module.exports (/usr/local/lib/node_modules/semantic-release/index.js:268:22)
    at async module.exports (/usr/local/lib/node_modules/semantic-release/cli.js:55:5)

I checked the verify.js and can see that the validator for labels just does a string check as opposed to the rest that checks if the value is either false or a valid string.

MeNsaaH avatar May 24 '22 19:05 MeNsaaH

Indeed, the verification logic is wrong here.

Happy to take a PR for fixing this :)

/cc @JonasSchubert

fgreinacher avatar May 27 '22 09:05 fgreinacher

Created a PR. Sorry for the bug!

JonasSchubert avatar May 27 '22 11:05 JonasSchubert