Skip to content

Commit 139142f

Browse files
chore: updated work flows
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
1 parent 1986a82 commit 139142f

7 files changed

Lines changed: 303 additions & 74 deletions

File tree

.github/workflows/build.yml

Lines changed: 101 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,113 @@
1-
# SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
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
27
# SPDX-License-Identifier: MIT
3-
name: Build
48

5-
on:
6-
pull_request:
7-
push:
8-
branches:
9-
- main
9+
name: Node
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: node-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
1019

1120
jobs:
12-
node:
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+
47+
build:
1348
runs-on: ubuntu-latest
1449

15-
strategy:
16-
matrix:
17-
node-version: ['22']
50+
needs: changes
51+
if: needs.changes.outputs.src != 'false'
1852

19-
name: node${{ matrix.node-version }}
53+
name: NPM build
2054
steps:
21-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
55+
- name: Checkout
56+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
57+
with:
58+
persist-credentials: false
2259

23-
- name: Set up node ${{ matrix.node-version }}
24-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
60+
- name: Read package.json node and npm engines version
61+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
62+
id: versions
2563
with:
26-
node-version: ${{ matrix.node-version }}
64+
fallbackNode: '^24'
65+
fallbackNpm: '^11.3'
2766

28-
- name: Install dependencies
29-
run: npm ci
67+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
68+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
69+
with:
70+
node-version: ${{ steps.versions.outputs.nodeVersion }}
3071

31-
- name: Build
32-
run: npm run build
72+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
73+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
74+
75+
- name: Validate package-lock.json # See https://github.com/npm/cli/issues/4460
76+
run: |
77+
npm i -g npm-package-lock-add-resolved@1.1.4
78+
npm-package-lock-add-resolved
79+
git --no-pager diff --exit-code
80+
81+
- name: Install dependencies & build
82+
env:
83+
CYPRESS_INSTALL_BINARY: 0
84+
PUPPETEER_SKIP_DOWNLOAD: true
85+
run: |
86+
npm ci
87+
npm run build --if-present
88+
89+
- name: Check build changes
90+
run: |
91+
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
92+
93+
- name: Show changes on failure
94+
if: failure()
95+
run: |
96+
git status
97+
git --no-pager diff
98+
exit 1 # make it red to grab attention
99+
100+
summary:
101+
permissions:
102+
contents: none
103+
runs-on: ubuntu-latest-low
104+
needs: [changes, build]
105+
106+
if: always()
107+
108+
# This is the summary, we just avoid to rename it so that branch protection rules still match
109+
name: node
110+
111+
steps:
112+
- name: Summary status
113+
run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi

.github/workflows/dependabot-approve-merge.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
6-
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
6+
# SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
77
# SPDX-License-Identifier: MIT
88

9-
name: Dependabot
9+
name: Auto approve Dependabot PRs
1010

1111
on:
12-
pull_request_target:
12+
pull_request_target: # zizmor: ignore[dangerous-triggers]
1313
branches:
1414
- main
1515
- master
@@ -24,11 +24,13 @@ concurrency:
2424

2525
jobs:
2626
auto-approve-merge:
27-
if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]'
27+
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]'
2828
runs-on: ubuntu-latest-low
2929
permissions:
3030
# for hmarr/auto-approve-action to approve PRs
3131
pull-requests: write
32+
# for alexwilson/enable-github-automerge-action to approve PRs
33+
contents: write
3234

3335
steps:
3436
- name: Disabled on forks
@@ -37,13 +39,20 @@ jobs:
3739
echo 'Can not approve PRs from forks'
3840
exit 1
3941
42+
- uses: mdecoleman/pr-branch-name@55795d86b4566d300d237883103f052125cc7508 # v3.0.0
43+
id: branchname
44+
with:
45+
repo-token: ${{ secrets.GITHUB_TOKEN }}
46+
4047
# GitHub actions bot approve
41-
- uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
48+
- uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0
49+
if: startsWith(steps.branchname.outputs.branch, 'dependabot/')
4250
with:
4351
github-token: ${{ secrets.GITHUB_TOKEN }}
4452

45-
# Nextcloud bot approve and merge request
46-
- uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2
53+
# Enable GitHub auto merge
54+
- name: Auto merge
55+
uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff # v2.0.0
56+
if: startsWith(steps.branchname.outputs.branch, 'dependabot/')
4757
with:
48-
target: minor
49-
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}
58+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/fixup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
- name: Run check
3434
uses: skjnldsv/block-fixup-merge-action@c138ea99e45e186567b64cf065ce90f7158c236a # v2
3535
with:
36-
repo-token: ${{ secrets.GITHUB_TOKEN }}
36+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint.yml

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,100 @@
1-
# SPDX-FileCopyrightText: 20210 Nextcloud GmbH and Nextcloud contributors
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
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
27
# SPDX-License-Identifier: MIT
3-
name: Lint
48

5-
on:
6-
pull_request:
7-
push:
8-
branches:
9-
- main
9+
name: Lint eslint
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: lint-eslint-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
1019

1120
jobs:
12-
node:
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+
- '.eslintrc.*'
44+
- '.eslintignore'
45+
- '**.js'
46+
- '**.ts'
47+
- '**.vue'
48+
49+
lint:
1350
runs-on: ubuntu-latest
1451

15-
strategy:
16-
matrix:
17-
node-version: ['22']
52+
needs: changes
53+
if: needs.changes.outputs.src != 'false'
54+
55+
name: NPM lint
1856

19-
name: node${{ matrix.node-version }}
2057
steps:
21-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
58+
- name: Checkout
59+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60+
with:
61+
persist-credentials: false
62+
63+
- name: Read package.json node and npm engines version
64+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
65+
id: versions
66+
with:
67+
fallbackNode: '^24'
68+
fallbackNpm: '^11.3'
2269

23-
- name: Set up node ${{ matrix.node-version }}
24-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
70+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
71+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
2572
with:
26-
node-version: ${{ matrix.node-version }}
73+
node-version: ${{ steps.versions.outputs.nodeVersion }}
74+
75+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
76+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
2777

2878
- name: Install dependencies
79+
env:
80+
CYPRESS_INSTALL_BINARY: 0
81+
PUPPETEER_SKIP_DOWNLOAD: true
2982
run: npm ci
3083

3184
- name: Lint
3285
run: npm run lint
86+
87+
summary:
88+
permissions:
89+
contents: none
90+
runs-on: ubuntu-latest-low
91+
needs: [changes, lint]
92+
93+
if: always()
94+
95+
# This is the summary, we just avoid to rename it so that branch protection rules still match
96+
name: eslint
97+
98+
steps:
99+
- name: Summary status
100+
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi

.github/workflows/npm-audit-fix.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
steps:
3333
- name: Checkout
3434
id: checkout
35-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3636
with:
3737
persist-credentials: false
3838
ref: ${{ matrix.branches }}
@@ -42,11 +42,11 @@ jobs:
4242
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
4343
id: versions
4444
with:
45-
fallbackNode: '^20'
46-
fallbackNpm: '^10'
45+
fallbackNode: '^24'
46+
fallbackNpm: '^11.3'
4747

4848
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
49-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
49+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
5050
with:
5151
node-version: ${{ steps.versions.outputs.nodeVersion }}
5252

@@ -67,7 +67,7 @@ jobs:
6767
6868
- name: Create Pull Request
6969
if: steps.checkout.outcome == 'success'
70-
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7.0.11
70+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
7171
with:
7272
token: ${{ secrets.COMMAND_BOT_PAT }}
7373
commit-message: 'fix(deps): Fix npm audit'

0 commit comments

Comments
 (0)