We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Description
Protecting tags generates a bad request error as the typing on the function is wrong.
Steps to reproduce
const gitlabApi = new Gitlab({ host: 'https://some.gitlab.host', token: tokenValue }) await gitlabApi.ProtectedTags.protect(projectId, "v*", { allowedToCreate: { groupId: GROUP_ID }, createAccessLevel: AccessLevel.MAINTAINER })
This is accepted by the typing but will throw a GitBeaker exception, since the server will response with a bad request.
Expected behaviour
It should create the protected tag.
Actual behaviour
The server responses with a HTTP status code 400 bad request.
Possible fixes
I can get it to work with this workaround:
const gitlabApi = new Gitlab({ host: 'https://some.gitlab.host', token: tokenValue }) await gitlabApi.ProtectedTags.protect(projectId, "v*", { allowedToCreate: [ { groupId: GROUP_ID } ] as unknown as ProtectedTagAccessLevelEntity, createAccessLevel: AccessLevel.MAINTAINER })
To me it seems the error is located on this line: https://github.com/jdalrymple/gitbeaker/blob/main/packages/core/src/resources/ProtectedTags.ts#L53
Instead of accepting a single entity it should accept an array of these entities:
allowedToCreate?: ProtectedTagAccessLevelEntity[];
The same will then also be true for this line (protect function instead of create): https://github.com/jdalrymple/gitbeaker/blob/main/packages/core/src/resources/ProtectedTags.ts#L79
protect
create
The GitLab documentation also clearly states this has to be a list of entities: https://docs.gitlab.com/ee/api/protected_tags.html#protect-repository-tags
Also under 16.11: https://archives.docs.gitlab.com/16.11/ee/api/protected_tags.html#protect-repository-tags
Checklist
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Protecting tags generates a bad request error as the typing on the function is wrong.
Steps to reproduce
This is accepted by the typing but will throw a GitBeaker exception, since the server will response with a bad request.
Expected behaviour
It should create the protected tag.
Actual behaviour
The server responses with a HTTP status code 400 bad request.
Possible fixes
I can get it to work with this workaround:
To me it seems the error is located on this line:
https://github.com/jdalrymple/gitbeaker/blob/main/packages/core/src/resources/ProtectedTags.ts#L53
Instead of accepting a single entity it should accept an array of these entities:
The same will then also be true for this line (
protect
function instead ofcreate
):https://github.com/jdalrymple/gitbeaker/blob/main/packages/core/src/resources/ProtectedTags.ts#L79
The GitLab documentation also clearly states this has to be a list of entities:
https://docs.gitlab.com/ee/api/protected_tags.html#protect-repository-tags
Also under 16.11:
https://archives.docs.gitlab.com/16.11/ee/api/protected_tags.html#protect-repository-tags
Checklist
The text was updated successfully, but these errors were encountered: