chore: update test script in package.json #1
Workflow file for this run
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
name: Lint changes in PR | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, ready_for_review] | |
jobs: | |
lint-nodejs-pr: | |
name: Lint NodeJS PR - ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Check if Node.js project and has package.json | |
id: packagejson | |
run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Check package-lock version | |
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master | |
id: lockversion | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "${{ steps.lockversion.outputs.version }}" | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Install dependencies | |
id: first-installation | |
run: npm install --loglevel verbose | |
continue-on-error: true | |
- if: steps.first-installation.outputs.status == 'failure' && steps.packagejson.outputs.exists == 'true' | |
name: Clear NPM cache and install deps again | |
run: | | |
npm cache clean --force | |
npm install --loglevel verbose | |
- name: Run linter | |
run: npm run lint --if-present |