-
Notifications
You must be signed in to change notification settings - Fork 36
73 lines (60 loc) · 2.17 KB
/
ui_test_primitives_diff.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: UI test
on:
pull_request:
jobs:
test:
if: ${{ github.repository == 'primer/brand' }}
name: Primitives diff
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout reference branch
uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
path: temp-main
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 18
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies (reference)
run: pushd temp-main; npm ci --legacy-peer-deps; popd
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build (reference)
run: pushd temp-main; npm run build --workspace=packages/design-tokens; popd
- name: Build
run: npm run build --workspace=packages/design-tokens
- name: Export diff
run: |
diff -r -y --width=300 -B -I 'Generated' --suppress-common-lines temp-main/packages/design-tokens/lib/design-tokens/css packages/design-tokens/lib/design-tokens/css | tail -n +2 > diff.txt
npx ts-node ./packages/design-tokens/scripts/ci-check-diff.ts
- name: Read raw diff
if: hashFiles('diff.md') != ''
id: diff
uses: juliangruber/read-file-action@v1
with:
path: ./diff.md
- name: Post diff
if: hashFiles('diff.md') != ''
uses: phulsechinmay/[email protected]
with:
message: ${{ steps.diff.outputs.content }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_IDENTIFIER: 'primitives-diff'
- name: Comment on the PR about no results
if: hashFiles('diff.md') == ''
uses: phulsechinmay/[email protected]
with:
message: |
### 🟢 No design token changes found
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_IDENTIFIER: 'primitives-diff'