22#
33# https://github.com/nextcloud/.github
44# 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
58
69name : Node
710
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
2512
2613permissions :
2714 contents : read
@@ -31,30 +18,59 @@ concurrency:
3118 cancel-in-progress : true
3219
3320jobs :
21+ changes :
22+ runs-on : ubuntu-latest-low
23+
24+ outputs :
25+ src : ${{ steps.changes.outputs.src}}
26+
27+ steps :
28+ - uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
29+ id : changes
30+ continue-on-error : true
31+ with :
32+ filters : |
33+ src:
34+ - '.github/workflows/**'
35+ - 'src/**'
36+ - 'appinfo/info.xml'
37+ - 'package.json'
38+ - 'package-lock.json'
39+ - 'tsconfig.json'
40+ - '**.js'
41+ - '**.ts'
42+ - '**.vue'
43+
3444 build :
3545 runs-on : ubuntu-latest
3646
37- name : node
47+ needs : changes
48+ if : needs.changes.outputs.src != 'false'
49+
50+ name : NPM build
3851 steps :
3952 - name : Checkout
40- uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
53+ uses : actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
4154
4255 - name : Read package.json node and npm engines version
43- uses : skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
56+ uses : skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
4457 id : versions
4558 with :
4659 fallbackNode : ' ^20'
47- fallbackNpm : ' ^9 '
60+ fallbackNpm : ' ^10 '
4861
4962 - name : Set up node ${{ steps.versions.outputs.nodeVersion }}
50- uses : actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
63+ uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
5164 with :
5265 node-version : ${{ steps.versions.outputs.nodeVersion }}
5366
5467 - name : Set up npm ${{ steps.versions.outputs.npmVersion }}
5568 run : npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
5669
5770 - name : Install dependencies & build
71+ env :
72+ CYPRESS_INSTALL_BINARY : 0
73+ PUPPETEER_SKIP_DOWNLOAD : true
5874 run : |
5975 npm ci
6076 npm run build --if-present
6985 git status
7086 git --no-pager diff
7187 exit 1 # make it red to grab attention
88+
89+ summary :
90+ permissions :
91+ contents : none
92+ runs-on : ubuntu-latest-low
93+ needs : [changes, build]
94+
95+ if : always()
96+
97+ # This is the summary, we just avoid to rename it so that branch protection rules still match
98+ name : node
99+
100+ steps :
101+ - name : Summary status
102+ run : if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi
0 commit comments