|
| 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 | + - "stable32" |
| 30 | + - "stable31" |
| 31 | + - "stable30" |
| 32 | + |
| 33 | + name: npm-audit-fix-${{ matrix.branches }} |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + id: checkout |
| 38 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.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: "^20" |
| 49 | + fallbackNpm: "^10" |
| 50 | + |
| 51 | + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} |
| 52 | + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.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@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 |
| 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