Skip to content

Commit 2040fea

Browse files
committed
ci: update node.yml workflow from template
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
1 parent 7d4f7b2 commit 2040fea

File tree

1 file changed

+59
-23
lines changed

1 file changed

+59
-23
lines changed

.github/workflows/node.yml

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,13 @@
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

69
name: 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

2613
permissions:
2714
contents: read
@@ -31,30 +18,64 @@ concurrency:
3118
cancel-in-progress: true
3219

3320
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+
3447
build:
3548
runs-on: ubuntu-latest
3649

37-
name: node
50+
needs: changes
51+
if: needs.changes.outputs.src != 'false'
52+
53+
name: NPM build
3854
steps:
3955
- name: Checkout
40-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
56+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57+
with:
58+
persist-credentials: false
4159

4260
- name: Read package.json node and npm engines version
43-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
61+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
4462
id: versions
4563
with:
4664
fallbackNode: '^20'
47-
fallbackNpm: '^9'
65+
fallbackNpm: '^10'
4866

4967
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
50-
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
68+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
5169
with:
5270
node-version: ${{ steps.versions.outputs.nodeVersion }}
5371

5472
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
55-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
73+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
5674

5775
- name: Install dependencies & build
76+
env:
77+
CYPRESS_INSTALL_BINARY: 0
78+
PUPPETEER_SKIP_DOWNLOAD: true
5879
run: |
5980
npm ci
6081
npm run build --if-present
@@ -69,3 +90,18 @@ jobs:
6990
git status
7091
git --no-pager diff
7192
exit 1 # make it red to grab attention
93+
94+
summary:
95+
permissions:
96+
contents: none
97+
runs-on: ubuntu-latest-low
98+
needs: [changes, build]
99+
100+
if: always()
101+
102+
# This is the summary, we just avoid to rename it so that branch protection rules still match
103+
name: node
104+
105+
steps:
106+
- name: Summary status
107+
run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)