Skip to content

Commit b15105e

Browse files
committedDec 16, 2020
Try show the baseline diff in the github PR

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed
 

‎.github/workflows/test_typescript.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,15 @@ jobs:
2323
# Move in the generated dom APIs into a new version of TSC
2424
cp -rf ../generated/* src/lib
2525
26-
# Run TypeScript's tests with the new DOM libs
27-
npm test
26+
# Run TypeScript's tests with the new DOM libs, but don't fail
27+
npm test || true
28+
gulp baseline-accept
29+
30+
# The git diff now is the difference between tests
31+
git diff > baseline-changes.diff
32+
33+
- name: Danger
34+
run: npm run danger -- ci
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+

‎dangerfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const {message} = require("danger")
2+
const {readFileSync, existsSync} = require("fs")
3+
4+
const diffPath = "baseline-changes.diff"
5+
if (existsSync(diffPath)) {
6+
const diffContents = readFileSync(diffPath, "utf8")
7+
message(diffContents)
8+
}

‎package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
"fetch-mdn": "npm run build && node ./lib/mdnfetcher.js",
88
"fetch": "echo This could take a few minutes... && npm run fetch-idl && npm run fetch-mdn",
99
"baseline-accept": "cpx \"generated\\*\" baselines\\",
10-
"test": "tsc -p ./tsconfig.json && node ./lib/index.js && node ./lib/test.js"
10+
"test": "tsc -p ./tsconfig.json && node ./lib/index.js && node ./lib/test.js",
11+
"danger": "danger"
1112
},
1213
"dependencies": {
1314
"@types/jsdom": "^16.2.4",
1415
"@types/node": "^14.6.4",
1516
"@types/node-fetch": "^2.5.7",
1617
"@types/webidl2": "^23.13.2",
1718
"cpx2": "^2.0.0",
19+
"danger": "^10.5.4",
1820
"jsdom": "^16.4.0",
1921
"node-fetch": "^2.6.1",
2022
"print-diff": "^1.0.0",

0 commit comments

Comments
 (0)
Please sign in to comment.