-
Notifications
You must be signed in to change notification settings - Fork 12
90 lines (75 loc) · 1.9 KB
/
example.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Example
on:
pull_request:
jobs:
build-base:
name: Build base
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{secrets.TOKEN_REPO}}
- name: Build
run: npm run build-demo
- name: Upload base stats.json
uses: actions/upload-artifact@v2
with:
name: base
path: ./demo/demo-dist/stats.json
retention-days: 1
build-pr:
name: Build PR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{secrets.TOKEN_REPO}}
- name: Build
run: npm run build-demo
- name: Upload base stats.json
uses: actions/upload-artifact@v2
with:
name: pr
path: ./demo/demo-dist/stats.json
retention-days: 1
report:
name: Generate report
runs-on: ubuntu-latest
needs: [build-base, build-pr]
steps:
- name: Checkout PR
uses: actions/checkout@v2
- name: Download base stats
uses: actions/download-artifact@v2
with:
name: base
path: base
- name: Download PR stats
uses: actions/download-artifact@v2
with:
name: pr
path: pr
- name: Get diff
id: get-diff
uses: ./
with:
base_path: './base/stats.json'
pr_path: './pr/stats.json'
- name: Comment
uses: NejcZdovc/comment-pr@v1
with:
file: 'comment.md'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
OLD: ${{steps.get-diff.outputs.base_file_string}}
NEW: ${{steps.get-diff.outputs.pr_file_string}}
DIFF: ${{steps.get-diff.outputs.diff_file_string}}
DIFF_PERCENT: ${{steps.get-diff.outputs.percent}}