name: Spell Check

on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

permissions:
  contents: read

jobs:
  spellcheck:
    runs-on: ubuntu-latest

    steps:
      # Checkout the branch that triggered the workflow
      - name: Checkout branch
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0  # v7

      # Setup Node 22+ for cspell
      - name: Setup Node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
        with:
          node-version: '22'

      # Install cspell globally
      - name: Install cspell
        run: npm install -g cspell@10.0.1

      # Run spell check
      - name: Run cspell
        run: npx cspell --no-progress --no-summary --config .github/cspell/cspell.json "**"
