Skip to content

Commit 57fe687

Browse files
authored
chore: add npm-audit-fix workflow
Signed-off-by: John Molakvoæ <[email protected]>
1 parent c654090 commit 57fe687

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

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

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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: 2023-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Npm audit fix and compile
10+
11+
on:
12+
workflow_dispatch:
13+
schedule:
14+
# At 2:30 on Sundays
15+
- cron: '30 2 * * 0'
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
branches: ['main', 'master', 'stable30', 'stable29', 'stable28']
25+
26+
name: npm-audit-fix-${{ matrix.branches }}
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
31+
with:
32+
ref: ${{ matrix.branches }}
33+
34+
- name: Read package.json node and npm engines version
35+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
36+
id: versions
37+
with:
38+
fallbackNode: '^20'
39+
fallbackNpm: '^10'
40+
41+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
42+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
43+
with:
44+
node-version: ${{ steps.versions.outputs.nodeVersion }}
45+
46+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
47+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
48+
49+
- name: Fix npm audit
50+
id: npm-audit
51+
uses: nextcloud-libraries/npm-audit-action@2a60bd2e79cc77f2cc4d9a3fe40f1a69896f3a87 # v0.1.0
52+
53+
- name: Run npm ci and npm run build
54+
if: always()
55+
env:
56+
CYPRESS_INSTALL_BINARY: 0
57+
run: |
58+
npm ci
59+
npm run build --if-present
60+
61+
- name: Create Pull Request
62+
if: always()
63+
uses: peter-evans/create-pull-request@6cd32fd93684475c31847837f87bb135d40a2b79 # v7.0.3
64+
with:
65+
token: ${{ secrets.COMMAND_BOT_PAT }}
66+
commit-message: 'fix(deps): Fix npm audit'
67+
committer: GitHub <[email protected]>
68+
author: nextcloud-command <[email protected]>
69+
signoff: true
70+
branch: automated/noid/${{ matrix.branches }}-fix-npm-audit
71+
title: '[${{ matrix.branches }}] Fix npm audit'
72+
body: ${{ steps.npm-audit.outputs.markdown }}
73+
labels: |
74+
dependencies
75+
3. to review

0 commit comments

Comments
 (0)