name: Check

on:
  push:
    branches:
      - main
      - 'renovate/**'
    paths-ignore:
      - '**.md'
      - '.gitignore'
      - 'assets/**'
      - '.github/**'
      - '!.github/workflows/check.yml'

  pull_request:
    branches:
      - main
    paths-ignore:
      - '**.md'
      - '.gitignore'
      - 'assets/**'
      - '.github/**'
      - '!.github/workflows/check.yml'

  workflow_dispatch:
  workflow_call:

jobs:
  lint-check-and-test:
    name: Lint, Check & Test
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

      - name: Setup pnpm
        uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0

      - name: Setup Node.js
        uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
        with:
          node-version: 18
          cache: pnpm

      - name: Install Dependencies
        run: |
          pnpm install
          pnpm exec playwright install --with-deps

      - name: Lint
        run: pnpm run lint

      - name: Check
        run: pnpm run check

      - name: Test
        run: pnpm run test