@@ -15,74 +15,105 @@ env:
15
15
CI : true
16
16
17
17
jobs :
18
+ see_if_should_skip :
19
+ runs-on : ubuntu-latest
20
+ # Map a step output to a job output
21
+ outputs :
22
+ should_skip : ${{ steps.skip_check.outputs.should_skip }}
23
+ steps :
24
+ - id : skip_check
25
+ uses : fkirc/skip-duplicate-actions@a12175f6209d4805b5a163d723270be2a0dc7b36
26
+ with :
27
+ cancel_others : ' false'
28
+ github_token : ${{ github.token }}
29
+ paths_ignore : ' [".all-contributorsrc", ".env.example", ".gitattributes", ".vscode/**", "app.json", "assets/**", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "contributing/**", "crowdin-actions-config.yml", "crowdin.yml", "docs", "javascripts/**", "jest-puppeteer.config.js", "LICENSE-CODE", "LICENSE", "nodemon.json", "ownership.yaml", "README.md", "script/**", "stylesheets/**"]'
18
30
lint :
31
+ needs : see_if_should_skip
19
32
runs-on : ubuntu-latest
20
33
steps :
21
- - name : Check out repo
34
+ # Each of these ifs needs to be repeated at each step to make sure the required check still runs
35
+ # Even if if doesn't do anything
36
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
37
+ name : Check out repo
22
38
uses : actions/checkout@v2
23
39
24
- - name : Setup node
40
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
41
+ name : Setup node
25
42
uses : actions/setup-node@v1
26
43
with :
27
44
node-version : 14.x
28
45
29
- - name : Get npm cache directory
46
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
47
+ name : Get npm cache directory
30
48
id : npm-cache
31
49
run : |
32
50
echo "::set-output name=dir::$(npm config get cache)"
33
51
34
- - name : Cache node modules
52
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
53
+ name : Cache node modules
35
54
uses : actions/cache@v2
36
55
with :
37
56
path : ${{ steps.npm-cache.outputs.dir }}
38
57
key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
39
58
restore-keys : |
40
59
${{ runner.os }}-node-
41
60
42
- - name : Install dependencies
61
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
62
+ name : Install dependencies
43
63
run : npm ci
44
64
45
- - name : Run linter
65
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
66
+ name : Run linter
46
67
run : npx standard
47
68
48
- - name : Check dependencies
69
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
70
+ name : Check dependencies
49
71
run : npm run check-deps
50
-
51
72
test :
73
+ needs : see_if_should_skip
52
74
runs-on : ubuntu-latest
53
75
strategy :
54
76
fail-fast : false
55
77
matrix :
56
78
test-group : [content, meta, rendering, routing, unit, links-and-images]
57
79
steps :
58
- - name : Check out repo
80
+ # Each of these ifs needs to be repeated at each step to make sure the required check still runs
81
+ # Even if if doesn't do anything
82
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
83
+ name : Check out repo
59
84
uses : actions/checkout@v2
60
85
61
- - name : Setup node
86
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
87
+ name : Setup node
62
88
uses : actions/setup-node@v1
63
89
with :
64
90
node-version : 14.x
65
91
66
- - name : Get npm cache directory
92
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
93
+ name : Get npm cache directory
67
94
id : npm-cache
68
95
run : |
69
96
echo "::set-output name=dir::$(npm config get cache)"
70
97
71
- - name : Cache node modules
98
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
99
+ name : Cache node modules
72
100
uses : actions/cache@v2
73
101
with :
74
102
path : ${{ steps.npm-cache.outputs.dir }}
75
103
key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
76
104
restore-keys : |
77
105
${{ runner.os }}-node-
78
106
79
- - name : Install dependencies
107
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
108
+ name : Install dependencies
80
109
run : npm ci
81
110
82
- - name : Run build script
111
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
112
+ name : Run build script
83
113
run : npm run build
84
114
85
- - name : Run tests
115
+ - if : ${{ needs.see_if_should_skip.outputs.should_skip == 'false' }}
116
+ name : Run tests
86
117
run : npx jest tests/${{ matrix.test-group }}/
87
118
88
119
- name : Send Slack notification if workflow fails
0 commit comments