|
| 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 | +name: Npm audit fix and compile |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + schedule: |
| 11 | + # At 2:30 on Sundays |
| 12 | + - cron: "30 2 * * 0" |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + branches: ["main", "master", "stable26", "stable25", "stable24"] |
| 22 | + |
| 23 | + name: npm-audit-fix-${{ matrix.branches }} |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 |
| 28 | + with: |
| 29 | + ref: ${{ matrix.branches }} |
| 30 | + |
| 31 | + - name: Read package.json node and npm engines version |
| 32 | + uses: skjnldsv/read-package-engines-version-actions@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2 |
| 33 | + id: versions |
| 34 | + with: |
| 35 | + fallbackNode: "^16" |
| 36 | + fallbackNpm: "^7" |
| 37 | + |
| 38 | + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} |
| 39 | + uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3 |
| 40 | + with: |
| 41 | + node-version: ${{ steps.versions.outputs.nodeVersion }} |
| 42 | + |
| 43 | + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} |
| 44 | + run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" |
| 45 | + |
| 46 | + - name: Fix npm audit |
| 47 | + run: | |
| 48 | + npm audit fix |
| 49 | +
|
| 50 | + - name: Run npm ci and npm run build |
| 51 | + if: always() |
| 52 | + run: | |
| 53 | + npm ci |
| 54 | + npm run build --if-present |
| 55 | +
|
| 56 | + - name: Create Pull Request |
| 57 | + if: always() |
| 58 | + uses: peter-evans/create-pull-request@284f54f989303d2699d373481a0cfa13ad5a6666 # v5 |
| 59 | + with: |
| 60 | + token: ${{ secrets.COMMAND_BOT_PAT }} |
| 61 | + commit-message: "chore(deps): fix npm audit" |
| 62 | + committer: GitHub <[email protected]> |
| 63 | + author: nextcloud-command <[email protected]> |
| 64 | + signoff: true |
| 65 | + branch: automated/noid/${{ matrix.branches }}-fix-npm-audit |
| 66 | + title: "[${{ matrix.branches }}] Fix npm audit" |
| 67 | + body: | |
| 68 | + Auto-generated fix of npm audit |
| 69 | + labels: | |
| 70 | + dependencies |
| 71 | + 3. to review |
0 commit comments