2
2
#
3
3
# https://github.com/nextcloud/.github
4
4
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5
+ #
6
+ # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7
+ # SPDX-License-Identifier: MIT
5
8
6
9
name : Node
7
10
8
- on :
9
- pull_request :
10
- paths :
11
- - ' .github/workflows/**'
12
- - ' src/**'
13
- - ' appinfo/info.xml'
14
- - ' package.json'
15
- - ' package-lock.json'
16
- - ' tsconfig.json'
17
- - ' **.js'
18
- - ' **.ts'
19
- - ' **.vue'
20
- push :
21
- branches :
22
- - main
23
- - master
24
- - stable*
11
+ on : pull_request
25
12
26
13
permissions :
27
14
contents : read
@@ -31,30 +18,62 @@ concurrency:
31
18
cancel-in-progress : true
32
19
33
20
jobs :
21
+ changes :
22
+ runs-on : ubuntu-latest-low
23
+ permissions :
24
+ contents : read
25
+ pull-requests : read
26
+
27
+ outputs :
28
+ src : ${{ steps.changes.outputs.src}}
29
+
30
+ steps :
31
+ - uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32
+ id : changes
33
+ continue-on-error : true
34
+ with :
35
+ filters : |
36
+ src:
37
+ - '.github/workflows/**'
38
+ - 'src/**'
39
+ - 'appinfo/info.xml'
40
+ - 'package.json'
41
+ - 'package-lock.json'
42
+ - 'tsconfig.json'
43
+ - '**.js'
44
+ - '**.ts'
45
+ - '**.vue'
46
+
34
47
build :
35
48
runs-on : ubuntu-latest
36
49
37
- name : node
50
+ needs : changes
51
+ if : needs.changes.outputs.src != 'false'
52
+
53
+ name : NPM build
38
54
steps :
39
55
- name : Checkout
40
- uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
56
+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
41
57
42
58
- name : Read package.json node and npm engines version
43
- uses : skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
59
+ uses : skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
44
60
id : versions
45
61
with :
46
- fallbackNode : ' ^16 '
47
- fallbackNpm : ' ^7 '
62
+ fallbackNode : ' ^20 '
63
+ fallbackNpm : ' ^10 '
48
64
49
65
- name : Set up node ${{ steps.versions.outputs.nodeVersion }}
50
- uses : actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
66
+ uses : actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
51
67
with :
52
68
node-version : ${{ steps.versions.outputs.nodeVersion }}
53
69
54
70
- name : Set up npm ${{ steps.versions.outputs.npmVersion }}
55
- run : npm i -g npm@" ${{ steps.versions.outputs.npmVersion }}"
71
+ run : npm i -g ' npm@${{ steps.versions.outputs.npmVersion }}'
56
72
57
73
- name : Install dependencies & build
74
+ env :
75
+ CYPRESS_INSTALL_BINARY : 0
76
+ PUPPETEER_SKIP_DOWNLOAD : true
58
77
run : |
59
78
npm ci
60
79
npm run build --if-present
70
89
git --no-pager diff
71
90
exit 1 # make it red to grab attention
72
91
73
- - name : Test
74
- run : npm run test --if-present
92
+ summary :
93
+ permissions :
94
+ contents : none
95
+ runs-on : ubuntu-latest-low
96
+ needs : [changes, build]
97
+
98
+ if : always()
99
+
100
+ # This is the summary, we just avoid to rename it so that branch protection rules still match
101
+ name : node
102
+
103
+ steps :
104
+ - name : Summary status
105
+ run : if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi
0 commit comments