danger / danger-js

⚠️ Stop saying "you forgot to …" in code review
http://danger.systems/js/
MIT License
5.22k stars 363 forks source link

Gitlab: Upgrade @gitbeaker/node from ^21.3.0 to ^35.8.1 [platform] GitLab #1406

Closed buffcode closed 10 months ago

buffcode commented 10 months ago

This is a follow up to https://github.com/danger/danger-js/pull/1327 by @ivankatliarchuk

buffcode commented 10 months ago

CI failed to due to temporary Yarn failure:

An unexpected error occurred: "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.12.0.tgz: Request failed \"502 Bad Gateway\"".
orta commented 10 months ago

I think the key for the

esModuleInterop had to be enabled for DTS generation because...

Is that the CLI command which is being called needs the --esModuleInterop arg inline

buffcode commented 10 months ago

Is that the CLI command which is being called needs the --esModuleInterop arg inline

Indeed, tsc won't use the tsconfig.json if the source file is specified directly... (https://github.com/microsoft/TypeScript/issues/6591#issuecomment-174343747)

orta commented 10 months ago

I'm not wild on:

Screenshot 2023-09-22 at 10 00 42

Because other danger runtimes, and the website use this schema to generate their DSLs/docs (which is why they were hand written before this PR) but all in all, I don't see enough activity in those spaces to really warrant keeping this restriction in place

Deploying this also might cause complications on the website which I'm probably not going to have any time to think about systemically for a long time so I guess we'll see how that goes too

glensc commented 9 months ago

breaking changes. should have written so in the changelog.

#19 3.627 src/rules/assignee.ts:26:66 - error TS2322: Type 'unknown' is not assignable to type 'number | undefined'.
#19 3.627 
#19 3.627 26     await gitlab.api.MergeRequests.edit(mr.project_id, mr.iid, { assigneeId: mr.author.id });

#19 3.628 src/utils/is_renovatebot.ts:1:27 - error TS2724: '"danger"' has no exported member named 'GitLabUser'. Did you mean 'GitHubUser'?
#19 3.628 
#19 3.628 1 import { GitCommitAuthor, GitLabUser } from "danger";
#19 3.628                             ~~~~~~~~~~
glensc commented 8 months ago

My fixes:

-    await gitlab.api.MergeRequests.edit(mr.project_id, mr.iid, { assigneeId: mr.author.id });
+    const assigneeId = Number(mr.author.id);
+    await gitlab.api.MergeRequests.edit(mr.project_id, mr.iid, { assigneeId });

And

-import { GitCommitAuthor, GitLabUser } from "danger";
+import { GitCommitAuthor } from "danger";
+import { Types as CoreTypes } from "@gitbeaker/core";
+
+type GitLabUser = Omit<CoreTypes.UserSchema, "created_at">;

maybe danger.js should export such GitLabUser for downstream projects to use?