name: Check

on:
  #? We want to run this workflow on pull requests to the rec branch
  #? Because we use the git flow workflow, the rec branch is the one that will receive the pull requests that may be invalid
  pull_request:
    branches:
      - rec
      - dev
  workflow_dispatch:

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 2
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20.x"
          cache: "npm"
      - name: Install dependencies
        run: npm install
      - name: Lint code
        run: npm run lint
      - name: Format code
        run: npm run prettier
      - name: Run tests
        run: npm test
