Skip to content

Commit 042c4fa

Browse files
committed
2 parents 3a42b04 + 0f48d32 commit 042c4fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2310
-1408
lines changed

.github/workflows/release.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release executable files for macOS
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_digit:
7+
description: 'Version digit (major | minor | patch)'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- major
13+
- minor
14+
- patch
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
HOMEBREW_TAP_DEPLOY_SECRET_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_SECRET_KEY }}
22+
permissions: write-all
23+
steps:
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@v2
26+
27+
- name: Install ldid
28+
uses: MOZGIII/install-ldid-action@v1
29+
with:
30+
tag: v2.1.5-procursus6
31+
32+
- name: Check out repository code
33+
uses: actions/checkout@v3
34+
35+
- name: Use node
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: "14"
39+
40+
- name: Install dependencies
41+
run: npm install
42+
43+
- name: Build
44+
run: npm run build
45+
46+
- name: Package
47+
run: |
48+
git config --global user.email "[email protected]"
49+
git config --global user.name "GitHub Action"
50+
npm run release -- ${{ github.event.inputs.version_digit }} --ci
51+
52+
- name: Update homebrew/tap repo for new release
53+
shell: bash
54+
run: scripts/create-homebrew-tap-pr.sh
55+
env:
56+
VERSION: ${{ env.VERSION }}

.release-it.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"release": true,
44
"assets": "brew-distribution/*.zip"
55
},
6-
"buildCommand": "yarn package",
6+
"buildCommand": "yarn package:x64; yarn package:arm64",
77
"hooks": {
88
"before:bump": "yarn declarations; yarn build:schemas",
9-
"after:bump": "yarn package",
10-
"after:release": "VERSION=${version} scripts/create-homebrew-tap-pr.sh"
9+
"after:bump": "yarn package:x64; yarn package:arm64",
10+
"after:release": "export VERSION=${version}; echo 'VERSION=${version}' >> $GITHUB_ENV"
1111
}
1212
}

CHANGELOG.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,34 @@
1616

1717
<!-- Your comment below this -->
1818

19+
- Support arm64 binary generation for Apple silicon users [#1342](https://github.com/danger/danger-js/pull/1342) [@pepix]
1920

2021
<!-- Your comment above this -->
2122

2223
## 11.1.2
2324

2425
- Bug fix for bitbucket bot detection ignoring case #1291
2526

27+
## 11.2.0
28+
29+
- Append random string to danger-results.json and danger-dsl.json files to better support concurrent processes #1311
30+
- Gitlab: add support for skipping remove of messages when empty [#1330](https://github.com/danger/danger-js/issues/1330) [@ivankatliarchuk]
31+
- Gitlab: package moved to a new home "@gitbreaker/*" [#1301](https://github.com/danger/danger-js/issues/1301) [@ivankatliarchuk]
32+
- GitLab: Improve support for MRs from forks [#1319](https://github.com/danger/danger-js/pull/1319) [@ivankatliarchuk]
33+
- GitLab: Added provider tests [#1319](https://github.com/danger/danger-js/pull/1319) [@ivankatliarchuk]
34+
- GitHub: Added `danger.github.pr.draft` field to DSL
35+
- GitLab: Add support for using threads instead of comments [#1331](https://github.com/danger/danger-js/pull/1331) [@uncaught]
36+
37+
## 11.1.2
38+
39+
- Improvements to `--staging` in Danger local
40+
- Protection against custom git prompts in Danger local
41+
2642
## 11.1.1
2743

2844
- Bug fix for over-deleting inline comments #1287
2945

30-
## 11.1.0
46+
## 11.1.0
3147

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

5874
- *Breaking:* Upgrade @octokit/rest from ^16.43.1 to ^18.12.0 - [#1204](https://github.com/danger/danger-js/pull/1204) [@fbartho]
59-
75+
6076
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.
6177

6278
# 10.8.1
@@ -1946,7 +1962,9 @@ Not usable for others, only stubs of classes etc. - [@orta]
19461962
[@hmschreiner]: https://github.com/hmschreiner
19471963
[@hongrich]: https://github.com/hongrich
19481964
[@igorbek]: https://github.com/igorbek
1965+
[@ivankatliarchuk]: https://github.com/ivankatliarchuk
19491966
[@iljadaderko]: https://github.com/IljaDaderko
1967+
[@ivankatliarchuk]: https://github.com/ivankatliarchuk
19501968
[@imorente]: https://github.com/imorente
19511969
[@jamiebuilds]: https://github.com/jamiebuilds
19521970
[@jamime]: https://github.com/jamime

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Following [this commit](https://github.com/danger/danger-js/commit/a26ac3b3bd4f0
4040
- Modify `changelog.md`, adding a new `### 0.21.0` heading under the `### Main` heading at the top of the file.
4141
- Commit both changes with the commit message **Version bump**.
4242
- Tag this commit - `git tag 0.21.0`.
43-
- Push the commit and tag to master - `git push origin main --follow-tags`. Travis CI will build the tagged commit and
44-
publish that tagged version to NPM.
43+
- Push the commit and tag to master - `git push origin main --follow-tags`. GitHub Actions will build the tagged commit
44+
and publish that tagged version to NPM.
4545

4646
:ship:
4747

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Codefresh, AppCenter, BitBucket Pipelines, Cirrus CI, Codemagic or Xcode Cloud.
2727
[![npm](https://img.shields.io/npm/v/danger.svg)](https://www.npmjs.com/package/danger)
2828
[![Build Status](https://travis-ci.org/danger/danger-js.svg?branch=main)](https://travis-ci.org/danger/danger-js)
2929
[![Build Status](https://ci.appveyor.com/api/projects/status/ep5hgeox3lbc5c7f?svg=true)](https://ci.appveyor.com/project/orta/danger-js/branch/main)
30-
[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/danger)
3130

3231
## For example?
3332

docs/issue_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ If this is a support request, e.g:
66
* Does Danger support ...?
77
* Is there a plugin for ...?
88

9-
Please use https://spectrum.chat/danger
9+
Please use discussions: https://github.com/danger/danger-js/discussions
1010

1111
If this issue feels like:
1212

docs/usage/gitlab.html.md

+5
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,8 @@ danger.gitlab.
4141
/** The commits associated with the merge request */
4242
commits: GitLabMRCommit[]
4343
```
44+
45+
---
46+
47+
If you want danger to open threads (discussions) instead of just commenting in merge requests, set an environment
48+
variable `DANGER_GITLAB_USE_THREADS` with value `1` or `true`.

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "danger",
3-
"version": "11.1.1",
3+
"version": "11.2.0",
44
"description": "Unit tests for Team Culture",
55
"main": "distribution/danger.js",
66
"typings": "distribution/danger.d.ts",
@@ -65,6 +65,8 @@
6565
"build:watch": "tsc -w",
6666
"link": "yarn run build && chmod +x distribution/commands/danger.js && yarn link",
6767
"package": "yarn run pkg . --output brew-distribution/danger; zip -j brew-distribution/danger-macos.zip brew-distribution/danger; shasum -a 256 brew-distribution/danger-macos.zip",
68+
"package:x64": "yarn run pkg . --output brew-distribution/danger-x64 --targets node16-macos-x64; zip -j brew-distribution/danger-macos-x64.zip brew-distribution/danger-x64; shasum -a 256 brew-distribution/danger-macos-x64.zip",
69+
"package:arm64": "yarn run pkg . --output brew-distribution/danger-arm64 --targets node16-macos-arm64; zip -j brew-distribution/danger-macos-arm64.zip brew-distribution/danger-arm64; shasum -a 256 brew-distribution/danger-macos-arm64.zip",
6870
"declarations": "ts-node ./scripts/create-danger-dts.ts",
6971
"docs:cp_defs": "mkdir docs/docs_generate; cp source/danger.d.ts docs/docs_generate; cp node_modules/@octokit/rest/index.d.ts docs/docs_generate/github.d.ts",
7072
"docs": "yarn run docs:cp_defs; yarn typedoc --ignoreCompilerErrors --mode modules --json docs/js_ref_dsl_docs.json --includeDeclarations source",
@@ -99,16 +101,14 @@
99101
"@types/async-retry": "^1.4.1",
100102
"@types/debug": "0.0.30",
101103
"@types/get-stdin": "^5.0.1",
102-
"@types/http-proxy-agent": "^2.0.1",
103104
"@types/jest": "^24.0.11",
104105
"@types/json5": "^0.0.30",
105106
"@types/jsonpointer": "^4.0.0",
106-
"@types/jsonwebtoken": "^7.2.8",
107+
"@types/jsonwebtoken": "^9.0.0",
107108
"@types/lodash.includes": "^4.3.4",
108109
"@types/lodash.mapvalues": "^4.6.6",
109110
"@types/lodash.memoize": "^4.1.3",
110111
"@types/micromatch": "^3.1.0",
111-
"@types/nock": "^10.0.3",
112112
"@types/node": "^10.11.3",
113113
"@types/node-fetch": "^2.5.12",
114114
"@types/p-limit": "^2.0.0",
@@ -130,7 +130,7 @@
130130
"jest-json-reporter": "^1.2.2",
131131
"lint-staged": "^12.3.7",
132132
"madge": "^5.0.1",
133-
"nock": "^10.0.6",
133+
"nock": "^13.2.0",
134134
"pkg": "^5.4.0",
135135
"prettier": "^2.5.1",
136136
"release-it": "^13.5.2",
@@ -150,13 +150,13 @@
150150
"debug": "^4.1.1",
151151
"fast-json-patch": "^3.0.0-1",
152152
"get-stdin": "^6.0.0",
153-
"gitlab": "^10.0.1",
154-
"http-proxy-agent": "^2.1.0",
155-
"https-proxy-agent": "^2.2.1",
153+
"@gitbeaker/node": "^21.3.0",
154+
"http-proxy-agent": "^5.0.0",
155+
"https-proxy-agent": "^5.0.1",
156156
"hyperlinker": "^1.0.0",
157157
"json5": "^2.1.0",
158158
"jsonpointer": "^5.0.0",
159-
"jsonwebtoken": "^8.4.0",
159+
"jsonwebtoken": "^9.0.0",
160160
"lodash.find": "^4.6.0",
161161
"lodash.includes": "^4.3.0",
162162
"lodash.isobject": "^3.0.2",

scripts/create-homebrew-tap-pr.sh

+43-14
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,65 @@
22

33
[ -z ${VERSION+x} ] && { echo "VERSION is missing"; exit 1; }
44

5-
FILE=brew-distribution/danger-macos.zip
5+
FILE_X64=brew-distribution/danger-macos-x64.zip
6+
FILE_ARM64=brew-distribution/danger-macos-arm64.zip
67

7-
if [ ! -f ${FILE} ]; then
8-
echo ${FILE} not found!
8+
if [ ! -f ${FILE_X64} ]; then
9+
echo ${FILE_X64} not found!
10+
exit 1
11+
fi
12+
if [ ! -f ${FILE_ARM64} ]; then
13+
echo ${FILE_ARM64} not found!
914
exit 1
1015
fi
1116

12-
SHA=$(shasum -a 256 ${FILE} | cut -f 1 -d " ")
13-
echo "$SHA"
17+
SHA_X64=$(shasum -a 256 ${FILE_X64} | cut -f 1 -d " ")
18+
echo "SHA_X64=$SHA_X64"
19+
SHA_ARM64=$(shasum -a 256 ${FILE_ARM64} | cut -f 1 -d " ")
20+
echo "SHA_ARM64=$SHA_ARM64"
21+
22+
# Set up SSH
23+
mkdir -p ~/.ssh
24+
echo "${HOMEBREW_TAP_DEPLOY_SECRET_KEY}" > ~/.ssh/id_rsa
25+
chmod 600 ~/.ssh/id_rsa
26+
git config --global user.name danger
27+
git config --global user.email [email protected]
28+
eval "$(ssh-agent -s)"
29+
ssh-add ~/.ssh/id_rsa
30+
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
31+
ssh -o StrictHostKeyChecking=no -F /dev/null -vT [email protected]
1432

1533
# Clone tap repo
1634
HOMEBREW_TAP_TMPDIR=$(mktemp -d)
17-
git clone --depth 1 https://github.com/danger/homebrew-tap.git "$HOMEBREW_TAP_TMPDIR"
35+
git clone --depth 1 git@github.com:danger/homebrew-tap.git "$HOMEBREW_TAP_TMPDIR"
1836
cd "$HOMEBREW_TAP_TMPDIR" || exit 1
1937

20-
# git config user.name danger
21-
# git config user.email [email protected]
22-
2338
# Write formula
2439
echo "class DangerJs < Formula" > danger-js.rb
2540
echo " homepage \"https://github.com/danger/danger-js\"" >> danger-js.rb
26-
echo " url \"https://github.com/danger/danger-js/releases/download/${VERSION}/danger-macos.zip\"" >> danger-js.rb
27-
echo " sha256 \"${SHA}\"" >> danger-js.rb
2841
echo >> danger-js.rb
29-
echo " def install" >> danger-js.rb
30-
echo " bin.install \"danger\"" >> danger-js.rb
42+
echo " if Hardware::CPU.intel?" >> danger-js.rb
43+
echo " url \"https://github.com/danger/danger-js/releases/download/${VERSION}/danger-macos-x64.zip\"" >> danger-js.rb
44+
echo " sha256 \"${SHA_X64}\"" >> danger-js.rb
45+
echo >> danger-js.rb
46+
echo " def install" >> danger-js.rb
47+
echo " bin.install \"danger-x64\" => \"danger\"" >> danger-js.rb
48+
echo " end" >> danger-js.rb
49+
echo " end" >> danger-js.rb
50+
echo >> danger-js.rb
51+
echo " if Hardware::CPU.arm?" >> danger-js.rb
52+
echo " url \"https://github.com/danger/danger-js/releases/download/${VERSION}/danger-macos-arm64.zip\"" >> danger-js.rb
53+
echo " sha256 \"${SHA_ARM64}\"" >> danger-js.rb
54+
echo >> danger-js.rb
55+
echo " def install" >> danger-js.rb
56+
echo " bin.install \"danger-arm64\" => \"danger\"" >> danger-js.rb
57+
echo " end" >> danger-js.rb
3158
echo " end" >> danger-js.rb
3259
echo "end" >> danger-js.rb
3360

3461
# Commit changes
3562
git add danger-js.rb
3663
git commit -m "Releasing danger-js version ${VERSION}"
37-
git push origin master
64+
git remote rm origin
65+
git remote add origin [email protected]:danger/homebrew-tap.git
66+
git push origin master

scripts/danger-dts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const createDTS = () => {
99
//
1010
1111
import { Octokit as GitHub } from "@octokit/rest"
12-
import { Gitlab } from "gitlab"
12+
import { Gitlab } from "@gitbeaker/node"
1313
import { File } from "parse-diff"
1414
1515
`

source/api/_tests/fetch.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as http from "http"
22
import * as node_fetch from "node-fetch"
33

4+
import type { HttpProxyAgent } from "http-proxy-agent"
5+
import type { HttpsProxyAgent } from "https-proxy-agent"
46
import { api } from "../fetch"
5-
import HttpProxyAgent from "http-proxy-agent"
6-
import HttpsProxyAgent from "http-proxy-agent"
77

88
interface ResponseMock {
99
body?: any
@@ -128,7 +128,7 @@ describe("fetch", () => {
128128
let options: node_fetch.RequestInit = { agent: undefined }
129129
await api(url, options, true, { HTTPS_PROXY: proxyUrl })
130130
let agent = options.agent as HttpsProxyAgent
131-
expect(agent.proxy.href).toBe(proxyUrl)
131+
expect(agent["proxy"].href).toBe(proxyUrl)
132132
})
133133

134134
it("sets proxy agent when https_proxy env variable is defined", async () => {
@@ -140,7 +140,7 @@ describe("fetch", () => {
140140
let options: node_fetch.RequestInit = { agent: undefined }
141141
await api(url, options, true, { https_proxy: proxyUrl })
142142
let agent = options.agent as HttpsProxyAgent
143-
expect(agent.proxy.href).toBe(proxyUrl)
143+
expect(agent["proxy"].href).toBe(proxyUrl)
144144
})
145145

146146
it("sets proxy agent when HTTP_PROXY env variable is defined", async () => {
@@ -152,7 +152,7 @@ describe("fetch", () => {
152152
let options: node_fetch.RequestInit = { agent: undefined }
153153
await api(url, options, true, { HTTP_PROXY: proxyUrl })
154154
let agent = options.agent as HttpProxyAgent
155-
expect(agent.proxy.href).toBe(proxyUrl)
155+
expect(agent["proxy"].href).toBe(proxyUrl)
156156
})
157157

158158
it("sets proxy agent when http_proxy env variable is defined", async () => {
@@ -164,6 +164,6 @@ describe("fetch", () => {
164164
let options: node_fetch.RequestInit = { agent: undefined }
165165
await api(url, options, true, { http_proxy: proxyUrl })
166166
let agent = options.agent as HttpProxyAgent
167-
expect(agent.proxy.href).toBe(proxyUrl)
167+
expect(agent["proxy"].href).toBe(proxyUrl)
168168
})
169169
})

source/api/fetch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function api(
113113

114114
if (!agent && proxy) {
115115
let secure = url.toString().startsWith("https")
116-
init.agent = secure ? new HttpsProxyAgent(proxy) : new HttpProxyAgent(proxy)
116+
init.agent = secure ? HttpsProxyAgent(proxy) : HttpProxyAgent(proxy)
117117
}
118118

119119
return retryableFetch(url, init).then(async (response: node_fetch.Response) => {

0 commit comments

Comments
 (0)