Skip to content
New issue

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

Issue 1301: gitlab dependency moved to a new home #1317

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions CHANGELOG.md
Expand Up @@ -16,7 +16,7 @@

<!-- 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/*" [@ivankatliarchuk]
<!-- Your comment above this -->

## 11.1.2
Expand All @@ -28,7 +28,7 @@

- Bug fix for over-deleting inline comments #1287

## 11.1.0
## 11.1.0

- Adds support for the new [GitHub Job summaries](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/) API via:
- `danger.github.setSummaryMarkdown("[markdown]")` for the JavaScript DSL
Expand Down Expand Up @@ -57,7 +57,7 @@
# 11.0.0 -> 11.0.2

- *Breaking:* Upgrade @octokit/rest from ^16.43.1 to ^18.12.0 - [#1204](https://github.com/danger/danger-js/pull/1204) [@fbartho]

This is only likely to hit you if you use `danger.github.api` pretty extensively in your Dangerfiles, but better to keep an eye out.

# 10.8.1
Expand Down Expand Up @@ -1947,6 +1947,7 @@ Not usable for others, only stubs of classes etc. - [@orta]
[@hmschreiner]: https://github.com/hmschreiner
[@hongrich]: https://github.com/hongrich
[@igorbek]: https://github.com/igorbek
[@ivankatliarchuk]: https://github.com/ivankatliarchuk
[@iljadaderko]: https://github.com/IljaDaderko
[@imorente]: https://github.com/imorente
[@jamiebuilds]: https://github.com/jamiebuilds
Expand Down
5 changes: 2 additions & 3 deletions package.json
Expand Up @@ -108,7 +108,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 @@ -130,7 +129,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 @@ -142,6 +141,7 @@
"typescript-json-schema": "^0.53.0"
},
"dependencies": {
"@gitbeaker/node": "21.3.0",
"@octokit/rest": "^18.12.0",
"async-retry": "1.2.3",
"chalk": "^2.3.0",
Expand All @@ -150,7 +150,6 @@
"debug": "^4.1.1",
"fast-json-patch": "^3.0.0-1",
"get-stdin": "^6.0.0",
"gitlab": "^10.0.1",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.1",
"hyperlinker": "^1.0.0",
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/danger.d.ts
Expand Up @@ -3,7 +3,7 @@
//

import { Octokit as GitHub } from "@octokit/rest"
import { Gitlab } from "gitlab"
import { Gitlab } from "@gitbeaker/node"
import { File } from "parse-diff"

type MarkdownString = string
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
7 changes: 4 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,8 @@ 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[]
// TODO: add pagination
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