[main] Fix npm audit #1731
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | |
# SPDX-License-Identifier: AGPL-3.0-or-later | |
name: Cypress Component Tests | |
on: pull_request | |
env: | |
# Adjust APP_NAME if your repository name is different | |
APP_NAME: ${{ github.event.repository.name }} | |
# This represents the server branch to checkout. | |
# Usually it's the base branch of the PR, but for pushes it's the branch itself. | |
# e.g. 'main', 'stable27' or 'feature/my-feature | |
# n.b. server will use head_ref, as we want to test the PR branch. | |
BRANCH: ${{ github.base_ref || github.ref_name }} | |
jobs: | |
cypress-component: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout app | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Read package.json node and npm engines version | |
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 | |
id: versions | |
with: | |
fallbackNode: "^20" | |
fallbackNpm: "^10" | |
- name: Set up node ${{ steps.versions.outputs.nodeVersion }} | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: ${{ steps.versions.outputs.nodeVersion }} | |
- name: Set up npm ${{ steps.versions.outputs.npmVersion }} | |
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" | |
- name: Install node dependencies | |
run: | | |
npm ci | |
- name: Cypress component tests | |
uses: cypress-io/github-action@1b70233146622b69e789ccdd4f9452adc638d25a # v6.6.1 | |
with: | |
component: true | |
env: | |
# Needs to be prefixed with CYPRESS_ | |
CYPRESS_BRANCH: ${{ env.BRANCH }} | |
# https://github.com/cypress-io/github-action/issues/124 | |
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} | |
# Needed for some specific code workarounds | |
TESTING: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CYPRESS_BUILD_ID: ${{ github.sha }}-${{ github.run_number }} | |
CYPRESS_GROUP: Run component | |
npm_package_name: ${{ env.APP_NAME }} |