Can not create release if patterns matches multiple files with the same name.
I'm getting this error,
[12:29:11 PM] [semantic-release] [@semantic-release/gitlab] › ✖ An error occurred while making a request to the GitLab release API:
HTTPError: Response code 400 (Bad Request)
at EventEmitter.<anonymous> (/home/ecarroll/n/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise.js:118:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
[12:29:11 PM] [semantic-release] › ✖ Failed step "publish" of plugin "@semantic-release/gitlab"
[12:29:11 PM] [semantic-release] › ✖ An error occurred while running semantic-release: HTTPError: Response code 400 (Bad Request)
at EventEmitter.<anonymous> (/home/ecarroll/n/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise.js:118:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
pluginName: '@semantic-release/gitlab'
}
HTTPError: Response code 400 (Bad Request)
at EventEmitter.<anonymous> (/home/ecarroll/n/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise.js:118:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
pluginName: '@semantic-release/gitlab'
}%
This error comes right after a release PUSH. Currently it's silently failing failing I opened this ticket to fix the silent failing: https://github.com/semantic-release/gitlab/issues/264
{
responseType: 'text',
body: '{"message":"Validation failed: Links have duplicate values (acme-angular-validators.js) for #\\u003cRelease:0x00007f0702a43908\\u003e scope"}'
}
You can see here that the problem is that GitLab errors with 400 (Bad Request) because it's upload multiple files (in different directories) to the release API.
dist/acme/angular-validators/fesm2015/acme-angular-validators.js
dist/acme/angular-validators/esm2015/acme-angular-validators.js
I believe the solution for this should be to add the paths to the file's basename, relatively to the pkgRoot.
This is the same issue as https://github.com/semantic-release/gitlab/issues/158
Note:
- It's not solved.
- the workaround "Found another even simpler workaround: remove the label property for any patterns that match more than one file. In this case, this module will fall back to creating each item with its label set to the file's name." doesn't work if the file name is not unique.
In order to fix this, I've patched it such that the label of the file in the release isn't just the basename, but the relative path to the pkgRoot.
Hi ! Thanks for this lib :)
I'am also experiencing the same issue as @EvanCarroll. I have a bunch of index.js / index.d.ts / index.js.map in my build and so i have duplicated names in my publish with this kind of json to post:
{
"tag_name": "v2.0.0",
"description": "...",
"assets": {
"links": [
{
"name": "index.js.map",
"url": "https://gitlab.com/myproject/uploads/d5b00462bb05eeb33004ac2898040868/index.js.map"
},
{
"name": "index.d.ts",
"url": "https://gitlab.com/myproject/uploads/a88f950454e5b647a62be66dcd919140/index.d.ts"
},
{
"name": "index.js.map",
"url": "https://gitlab.com/myproject/uploads/edd80896ff97a2cf4233cd9ef47a7983/index.js.map"
},
....
]
}
Resulting in an error Validation failed: Links have duplicate values.
I've seen the PR from @EvanCarroll 267 that could manage to have unique label / name. Is is possible to review his PR or if you have any other suggestions I could work on a PR too !
Thanks