Skip to content

Commit ea6b6cb

Browse files
committed
ci(npm): Create npm-audit-fix.yml
Signed-off-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
1 parent 1656115 commit ea6b6cb

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
permissions:
18+
contents: read
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
branches:
28+
- ${{ github.event.repository.default_branch }}
29+
- 'stable34'
30+
- 'stable33'
31+
- 'stable32'
32+
33+
name: npm-audit-fix-${{ matrix.branches }}
34+
35+
steps:
36+
- name: Checkout
37+
id: checkout
38+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
39+
with:
40+
persist-credentials: false
41+
ref: ${{ matrix.branches }}
42+
continue-on-error: true
43+
44+
- name: Read package.json node and npm engines version
45+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
46+
id: versions
47+
with:
48+
fallbackNode: '^24'
49+
fallbackNpm: '^11.3'
50+
51+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
52+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
53+
with:
54+
node-version: ${{ steps.versions.outputs.nodeVersion }}
55+
56+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
57+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
58+
59+
- name: Fix npm audit
60+
id: npm-audit
61+
uses: nextcloud-libraries/npm-audit-action@1b1728b2b4a7a78d69de65608efcf4db0e3e42d0 # v0.2.0
62+
63+
- name: Run npm ci and npm run build
64+
if: steps.checkout.outcome == 'success'
65+
env:
66+
CYPRESS_INSTALL_BINARY: 0
67+
run: |
68+
npm ci
69+
npm run build --if-present
70+
71+
- name: Create Pull Request
72+
if: steps.checkout.outcome == 'success'
73+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
74+
with:
75+
token: ${{ secrets.COMMAND_BOT_PAT }}
76+
commit-message: 'fix(deps): Fix npm audit'
77+
committer: GitHub <noreply@github.com>
78+
author: nextcloud-command <nextcloud-command@users.noreply.github.com>
79+
signoff: true
80+
branch: automated/noid/${{ matrix.branches }}-fix-npm-audit
81+
title: '[${{ matrix.branches }}] Fix npm audit'
82+
body: ${{ steps.npm-audit.outputs.markdown }}
83+
labels: |
84+
dependencies
85+
3. to review

0 commit comments

Comments
 (0)