@@ -16,20 +16,31 @@ jobs:
16
16
- uses : actions/checkout@v2
17
17
with :
18
18
fetch-depth : 3
19
+ - uses : technote-space/get-diff-action@v1
20
+ id : git-diff
21
+ with :
22
+ PREFIX_FILTER : |
23
+ src/
24
+ __tests__/
25
+ SUFFIX_FILTER : .ts
19
26
- name : Get Yarn Cache Directory
20
27
id : yarn-cache
21
28
run : echo "::set-output name=dir::$(yarn cache dir)"
29
+ if : steps.git-diff.outputs.diff
22
30
- name : Cache node dependencies
23
31
uses : actions/cache@v1
24
32
with :
25
33
path : ${{ steps.yarn-cache.outputs.dir }}
26
34
key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
27
35
restore-keys : |
28
36
${{ runner.os }}-yarn-
37
+ if : steps.git-diff.outputs.diff
29
38
- name : Install Package dependencies
30
39
run : yarn install
40
+ if : steps.git-diff.outputs.diff
31
41
- name : Check code style
32
- run : yarn lint
42
+ run : yarn eslint ${{ steps.git-diff.outputs.diff }}
43
+ if : steps.git-diff.outputs.diff
33
44
- uses : 8398a7/action-slack@v1
34
45
with :
35
46
type : failure
@@ -49,30 +60,42 @@ jobs:
49
60
- uses : actions/checkout@v2
50
61
with :
51
62
fetch-depth : 3
63
+ - uses : technote-space/get-diff-action@v1
64
+ id : git-diff
65
+ with :
66
+ PREFIX_FILTER : |
67
+ src/
68
+ __tests__/
69
+ SUFFIX_FILTER : .ts
52
70
- name : Setup node
53
71
uses : actions/setup-node@v1
54
72
with :
55
73
node-version : ${{ matrix.node }}
74
+ if : steps.git-diff.outputs.diff || github.event_name == 'push'
56
75
- name : Get Yarn Cache Directory
57
76
id : yarn-cache
58
77
run : echo "::set-output name=dir::$(yarn cache dir)"
78
+ if : steps.git-diff.outputs.diff || github.event_name == 'push'
59
79
- name : Cache node dependencies
60
80
uses : actions/cache@v1
61
81
with :
62
82
path : ${{ steps.yarn-cache.outputs.dir }}
63
83
key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
64
84
restore-keys : |
65
85
${{ runner.os }}-yarn-
86
+ if : steps.git-diff.outputs.diff || github.event_name == 'push'
66
87
- name : Install Package dependencies
67
88
run : yarn install
89
+ if : steps.git-diff.outputs.diff || github.event_name == 'push'
68
90
- name : Run tests
69
91
run : yarn cover
92
+ if : steps.git-diff.outputs.diff || github.event_name == 'push'
70
93
- name : Codecov
71
94
run : curl -s https://codecov.io/bash | bash -s -- -t $CODECOV_TOKEN -f $COVERAGE_FILE
72
95
env :
73
96
CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
74
97
COVERAGE_FILE : ./coverage/lcov.info
75
- if : matrix.node == '12'
98
+ if : matrix.node == '12' && (steps.git-diff.outputs.diff || github.event_name == 'push')
76
99
- uses : 8398a7/action-slack@v1
77
100
with :
78
101
type : failure
0 commit comments