Closed ivankatliarchuk closed 1 year ago
I don't think those are on that object (I think the PR had the wrong text) try without the .api
(or check the typescript types
I went through the code.
danger.gitlab.api
actually returns InstanceType<typeof Gitlab>
. Not sure if was it intentional or not, but as a result, functions addLabels
and removeLabels
not used anywhere in the library, would assume not in use outide of it too.
Does it sound allright if I make them available through danger.gitlab.uits.addLabels
? Other option is to remove them, as its just redundant/untested piece of code.
I think it is available as danger.gitlab.addLabels
judging on the code
console.log(Object.getOwnPropertyNames(danger.gitlab))
console.log(Object.getOwnPropertyNames(danger.gitlab).filter(function (p) {
return typeof danger.gitlab[p] === 'function';
}));
output
[ 'metadata', 'mr', 'commits', 'approvals', 'utils', 'api' ]
[]
Not the end of the world
/_matrix/client/r0/auth/
Looks like there is an inconstitency in the code e.g. Github https://github.com/danger/danger-js/issues/1008
danger.github.utils.createOrAddLabel
While Gitlab does not have anything like danger.gitlab.uits.createOrAddLabel
This should add the two methods under utils:
but imho, this is a mess, why need to map, why not expose the whole "api"?
The actual breakage was from this commit by @orta:
Find source/platforms/GitLab.ts
file in the diff because the commit is huge
That commit links to https://github.com/danger/danger-js/pull/1192 that has no context, at all, but 250 commits spanning multiple releases and merges or what the "improper" was. imho now the dsl exposed is improper raw GitLab class import { Gitlab } from "@gitbeaker/node"
rather danger-js GitLabAPI class
Changelog is recorded in such way that the same person added addLabels/removeLabels and broke them in subsequent pr?
# 10.6.6
Fix for supporting Bitbucket Server personal repositories
GitLab: Added GitLabApi to danger.gitlab.api. - [@shyim]
GitLab: Added label helper functions to danger.gitlab.api.addLabels and danger.gitlab.api.removeLabels. - [@shyim]
cc @shyim
Describe the bug
Probably not a bug, I might be missing something. According to this PR, following should just work
However its not a case.
To Reproduce Steps to reproduce the behavior:
TypeError: addLabels is not a function at beforeCompletion (dangerfile.js:2:9)
For ts, same result
TypeError: addLabels is not a function
Expected behavior It should update labels.
Current approach
Labels updated.
Screenshots
Your Environment