name: Run linters
on: [push]

env:
  PNPM_CACHE_FOLDER: .pnpm-store
  HUSKY: 0 # Bypass husky commit hook for CI

jobs:
  lint:
    name: Lint all projects
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: setup caching
        uses: actions/cache@v2
        with:
          path: ${{ env.PNPM_CACHE_FOLDER }}
          key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
          restore-keys: |
            ${{ runner.os }}-pnpm-

      - name: setup pnpm
        uses: pnpm/action-setup@v2.2.4
        with:
          version: 7

      - name: setup node.js
        uses: actions/setup-node@v2
        with:
          node-version: 16.x
          cache: 'pnpm'

      - name: setup pnpm config
        run: pnpm config set store-dir $PNPM_CACHE_FOLDER

      - run: pnpm install --no-frozen-lockfile --shamefully-hoist

      - name: Run Lint
        run: pnpm run lint
