Skip to content

Commit

Permalink
Merge pull request #1428 from heltoft/fix-gitlab-inline-comments
Browse files Browse the repository at this point in the history
[GitLab] Fixes to inline comments
  • Loading branch information
orta authored Apr 16, 2024
2 parents 81645a6 + d353324 commit 3945263
Show file tree
Hide file tree
Showing 32 changed files with 7,848 additions and 4,580 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:

steps:
# Check out, and set up the node/ruby infra
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
tag: v2.1.5-procursus6

- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "14"
node-version: "18"

- name: Install dependencies
run: npm install
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
## Main

<!-- Your comment below this -->
- Upgrade `node` engine from `>=14.13.1` to `>=18` [@heltoft]
- Upgrade `@types/node` from `^10.11.3` to `18.19.18` [@heltoft]
- GitLab: [#1386] Move from `@gitbeaker/node` to `@gitbeaker/rest` [@heltoft]
- GitLab: [#1412] Danger fails to create inline comments on Gitlab [@heltoft]
- GitLab: [#1405] Can't post multiple inline comments [@heltoft]
- GitLab: Do not delete system resolved danger inline comments [@heltoft]
<!-- Your comment above this -->

## 11.3.1
Expand Down Expand Up @@ -2002,6 +2008,7 @@ Not usable for others, only stubs of classes etc. - [@orta]
[@hanneskaeufler]: https://github.com/hanneskaeufler
[@happylinks]: https://github.com/happylinks
[@hellocore]: https://github.com/HelloCore
[@heltoft]: https://github.com/heltoft
[@hiroppy]: https://github.com/hiroppy
[@hmcc]: https://github.com/hmcc
[@hmschreiner]: https://github.com/hmschreiner
Expand Down
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
},
"homepage": "https://github.com/danger/danger-js#readme",
"engines": {
"node": ">=14.13.1"
"node": ">=18"
},
"devDependencies": {
"@babel/cli": "7.16.7",
Expand All @@ -101,15 +101,15 @@
"@types/async-retry": "^1.4.1",
"@types/debug": "0.0.30",
"@types/get-stdin": "^5.0.1",
"@types/jest": "^24.0.11",
"@types/jest": "^28.0.0",
"@types/json5": "^0.0.30",
"@types/jsonpointer": "^4.0.0",
"@types/jsonwebtoken": "^9.0.0",
"@types/lodash.includes": "^4.3.4",
"@types/lodash.mapvalues": "^4.6.6",
"@types/lodash.memoize": "^4.1.3",
"@types/micromatch": "^3.1.0",
"@types/node": "^10.11.3",
"@types/node": "18.19.18",
"@types/node-fetch": "^2.5.12",
"@types/p-limit": "^2.0.0",
"@types/prettier": "^1.16.1",
Expand All @@ -126,17 +126,17 @@
"eslint-plugin-jsdoc": "^48.1.0",
"flow-bin": "^0.77.0",
"husky": "^1.0.1",
"jest": "^24.0.0",
"jest": "^28.0.0",
"jest-json-reporter": "^1.2.2",
"lint-staged": "^12.3.7",
"madge": "^5.0.1",
"madge": "^6.0.1",
"nock": "^13.2.0",
"pkg": "^5.4.0",
"pkg": "^5.8.1",
"prettier": "^2.5.1",
"release-it": "^13.5.2",
"shx": "^0.3.4",
"ts-jest": "^24.0.2",
"ts-node": "^8.0.2",
"ts-jest": "^28.0.0",
"ts-node": "^10.9.2",
"typedoc": "0.9.0",
"typescript": "^4.5.5",
"typescript-json-schema": "^0.53.0"
Expand All @@ -150,8 +150,7 @@
"debug": "^4.1.1",
"fast-json-patch": "^3.0.0-1",
"get-stdin": "^6.0.0",
"@gitbeaker/core": "^35.8.1",
"@gitbeaker/node": "^35.8.1",
"@gitbeaker/rest": "^38.0.0",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
"hyperlinker": "^1.0.0",
Expand Down Expand Up @@ -188,4 +187,4 @@
"pre-push": "yarn build; yarn danger:prepush"
}
}
}
}
3 changes: 1 addition & 2 deletions scripts/danger-dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const createDTS = () => {
//
import { Octokit as GitHub } from "@octokit/rest"
import { Gitlab, Types } from "@gitbeaker/node"
import { Types as CoreTypes } from "@gitbeaker/core/dist"
import type * as Types from "@gitbeaker/rest"
import { File } from "parse-diff"
`
Expand Down
3 changes: 1 addition & 2 deletions scripts/run-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const child_process = require("child_process")
const { resolve } = require("path")
const { basename } = require("path")
const chalk = require("chalk")
const expect = require("expect")
const expect = require("expect").expect

const runnerFileJS = "distribution/commands/danger-runner.js"

Expand Down Expand Up @@ -75,7 +75,6 @@ const runDangerfile = (fixture) => {
const fixturedResults = JSON.parse(fs.readFileSync(dangerfileResults, "utf8"))
// Fails include traces etc
expect(runtimeResults).toEqual(fixturedResults)

const tick = chalk.bold.greenBright("✓")
process.stdout.write(" " + tick)

Expand Down
10 changes: 8 additions & 2 deletions source/api/_tests/fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class TestServer {
start = async (response: ResponseMock): Promise<void> => {
this.response = response
return new Promise<void>((resolve, reject) => {
this.server.listen(this.port, this.hostname, (err: any) => (err ? reject(err) : resolve()))
this.server.on("error", (e) => {
reject(e)
})
this.server.listen(this.port, this.hostname, undefined, () => resolve())
})
}
stop = async (): Promise<void> => {
Expand All @@ -52,7 +55,10 @@ class TestProxy {
start = async (): Promise<void> => {
return new Promise<void>((resolve, reject) => {
this.isRunning = true
this.server.listen(this.port, this.hostname, (err: any) => (err ? reject(err) : resolve()))
this.server.on("error", (e) => {
reject(e)
})
this.server.listen(this.port, this.hostname, undefined, () => resolve())
})
}
stop = async (): Promise<void> => {
Expand Down
10 changes: 4 additions & 6 deletions source/commands/danger-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { prepareDangerDSL } from "./utils/runDangerSubprocess"
import { runRunner } from "./ci/runner"
import { Platform, getPlatformForEnv } from "../platforms/platform"
import { CISource } from "../ci_source/ci_source"
import { getGitLabAPICredentialsFromEnv } from "../platforms/gitlab/GitLabAPI"
import { getGitLabHostFromEnv } from "../platforms/gitlab/GitLabAPI"

const d = debug("pr")
const log = console.log
Expand All @@ -25,8 +25,6 @@ interface App extends SharedCLI {
js?: boolean
}

const gitLabApiCredentials = getGitLabAPICredentialsFromEnv(process.env)

program
.usage("[options] <pr_url>")
.description("Emulate running Danger against an existing GitHub Pull Request.")
Expand All @@ -43,8 +41,8 @@ program
!process.env["DANGER_BITBUCKETCLOUD_OAUTH_KEY"] &&
!process.env["DANGER_BITBUCKETCLOUD_USERNAME"] &&
!process.env["DANGER_BITBUCKETCLOUD_REPO_ACCESSTOKEN"] &&
!gitLabApiCredentials.token &&
!gitLabApiCredentials.oauthToken
!process.env["DANGER_GITLAB_API_TOKEN"] &&
!process.env["DANGER_GITLAB_API_OAUTH_TOKEN"]
) {
log("")
log(
Expand Down Expand Up @@ -74,7 +72,7 @@ if (program.args.length === 0) {
process.exitCode = 1
} else {
const customHost =
process.env["DANGER_GITHUB_HOST"] || process.env["DANGER_BITBUCKETSERVER_HOST"] || gitLabApiCredentials.host // this defaults to https://gitlab.com
process.env["DANGER_GITHUB_HOST"] || process.env["DANGER_BITBUCKETSERVER_HOST"] || getGitLabHostFromEnv(process.env) // This defaults to https://www.gitlab.com

// Allow an ambiguous amount of args to find the PR reference
const findPR = program.args.find((a) => a.includes(customHost) || a.includes("github") || a.includes("bitbucket.org"))
Expand Down
Loading

0 comments on commit 3945263

Please sign in to comment.