name: Coding Standards

on:
  push:
    branches:
      - main
    paths-ignore:
      - '**.md'

  pull_request:
    branches:
      - main

  workflow_dispatch:

jobs:
  lint:
    name: Lint and build
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Lint JS
        run: npx wp-scripts lint-js

      - name: Lint CSS
        run: npx wp-scripts lint-style

      - name: Build
        run: npx wp-scripts build