Skip to content

Commit

Permalink
Merge pull request #1318 from ivankatliarchuk/issue_1301
Browse files Browse the repository at this point in the history
issue-1301: Migrate gitlab to a new home
  • Loading branch information
orta committed Oct 1, 2022
2 parents 6a216a1 + f6d17c0 commit 8e58eae
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 133 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -16,8 +16,11 @@

<!-- Your comment below this -->
- Append random string to danger-results.json and danger-dsl.json files to better support concurrent processes #1311

- Gitlab package moved to a new home "@gitbreaker/*" [#1301](https://github.com/danger/danger-js/issues/1301) [@ivankatliarchuk]
- GitLab: Improve support for MRs from forks [#1319](https://github.com/danger/danger-js/pull/1319) [@ivankatliarchuk]
- GitLab: Added provider tests [#1319](https://github.com/danger/danger-js/pull/1319) [@ivankatliarchuk]

<!-- Your comment above this -->

## 11.1.2
Expand Down Expand Up @@ -1950,6 +1953,7 @@ Not usable for others, only stubs of classes etc. - [@orta]
[@igorbek]: https://github.com/igorbek
[@ivankatliarchuk]: https://github.com/ivankatliarchuk
[@iljadaderko]: https://github.com/IljaDaderko
[@ivankatliarchuk]: https://github.com/ivankatliarchuk
[@imorente]: https://github.com/imorente
[@jamiebuilds]: https://github.com/jamiebuilds
[@jamime]: https://github.com/jamime
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -107,7 +107,6 @@
"@types/lodash.mapvalues": "^4.6.6",
"@types/lodash.memoize": "^4.1.3",
"@types/micromatch": "^3.1.0",
"@types/nock": "^10.0.3",
"@types/node": "^10.11.3",
"@types/node-fetch": "^2.5.12",
"@types/p-limit": "^2.0.0",
Expand All @@ -129,7 +128,7 @@
"jest-json-reporter": "^1.2.2",
"lint-staged": "^12.3.7",
"madge": "^5.0.1",
"nock": "^10.0.6",
"nock": "^13.2.0",
"pkg": "^5.4.0",
"prettier": "^2.5.1",
"release-it": "^13.5.2",
Expand All @@ -149,6 +148,7 @@
"debug": "^4.1.1",
"fast-json-patch": "^3.0.0-1",
"get-stdin": "^6.0.0",
"@gitbeaker/node": "^21.3.0",
"gitlab": "^10.0.1",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/danger-dts.ts
Expand Up @@ -9,7 +9,7 @@ const createDTS = () => {
//
import { Octokit as GitHub } from "@octokit/rest"
import { Gitlab } from "gitlab"
import { Gitlab } from "@gitbeaker/node"
import { File } from "parse-diff"
`
Expand Down
2 changes: 1 addition & 1 deletion source/dsl/GitLabDSL.ts
@@ -1,7 +1,7 @@
// Please don't have includes in here that aren't inside the DSL folder, or the d.ts/flow defs break

// TODO: extract out from BitBucket specifically, or create our own type
import { Gitlab } from "gitlab"
import { Gitlab } from "@gitbeaker/node"
import { RepoMetaData } from "./BitBucketServerDSL"

// getPlatformReviewDSLRepresentation
Expand Down
6 changes: 3 additions & 3 deletions source/platforms/gitlab/GitLabAPI.ts
Expand Up @@ -14,7 +14,7 @@ import {
GitLabApproval,
} from "../../dsl/GitLabDSL"

import { Gitlab } from "gitlab"
import { Gitlab } from "@gitbeaker/node"
import { Env } from "../../ci_source/ci_source"
import { debug } from "../../debug"

Expand Down Expand Up @@ -107,7 +107,7 @@ class GitLabAPI {
getMergeRequestApprovals = async (): Promise<GitLabApproval> => {
this.d(`getMergeRequestApprovals for repo: ${this.repoMetadata.repoSlug} pr: ${this.repoMetadata.pullRequestID}`)
const approvals = (await this.api.MergeRequests.approvals(this.repoMetadata.repoSlug, {
mergerequestIId: Number(this.repoMetadata.pullRequestID),
mergerequestIid: Number(this.repoMetadata.pullRequestID),
})) as GitLabApproval
this.d("getMergeRequestApprovals", approvals)
return approvals
Expand Down Expand Up @@ -137,7 +137,7 @@ class GitLabAPI {
getMergeRequestNotes = async (): Promise<GitLabNote[]> => {
this.d("getMergeRequestNotes", this.repoMetadata.repoSlug, this.repoMetadata.pullRequestID)
const api = this.api.MergeRequestNotes
const notes = (await api.all(this.repoMetadata.repoSlug, this.repoMetadata.pullRequestID)) as GitLabNote[]
const notes = (await api.all(this.repoMetadata.repoSlug, this.repoMetadata.pullRequestID, {})) as GitLabNote[]
this.d("getMergeRequestNotes", notes)
return notes
}
Expand Down
6 changes: 3 additions & 3 deletions source/platforms/gitlab/_tests/_gitlab_api.test.ts
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import nock, { NockDefinition } from "nock"
import nock, { Definition } from "nock"
import { default as GitLabAPI, getGitLabAPICredentialsFromEnv } from "../GitLabAPI"
import { resolve } from "path"
import { readFileSync } from "fs"
Expand Down Expand Up @@ -56,8 +56,8 @@ describe("GitLab API", () => {
expect(api.mergeRequestURL).toBe("https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/27117")
})

const sanitizeUserResponse = (nocks: NockDefinition[]): NockDefinition[] => {
return nocks.map((nock: NockDefinition) => {
const sanitizeUserResponse = (nocks: Definition[]): Definition[] => {
return nocks.map((nock: Definition) => {
let { response, ...restNock } = nock

// @ts-ignore
Expand Down

0 comments on commit 8e58eae

Please sign in to comment.