name: Test & lint JS stuff

on:
  pull_request:
    branches: [ "main" ]

jobs:
  test-and-lint-js:
    name: Test & lint JS stuff
    runs-on: ubuntu-20.04

    steps:
      - uses: actions/checkout@v2

      - name: Cache dependencies
        uses: actions/cache@v2
        with:
          path: node_modules
          key: ${{ runner.os }}-npm-dependencies-${{ hashFiles('package.lock') }}
          restore-keys: ${{ runner.os }}-npm-dependencies

      - name: Set up node
        uses: actions/setup-node@v2
        with:
          node-version: 16

      - name: Instal npm dependencies
        run: npm install

      - name: Run JS linter
        run: npm run lint
