name: cspell

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

env:
  FORCE_COLOR: 2

permissions:
  contents: read

jobs:
  cspell:
    permissions:
      # allow streetsidesoftware/cspell-action to fetch files for commits and PRs
      contents: read
      pull-requests: read
    runs-on: ubuntu-latest

    steps:
      - name: Clone repository
        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
          persist-credentials: false

      - name: Run cspell
        uses: streetsidesoftware/cspell-action@dcd03dc3e8a59ec2e360d0c62db517baa0b4bb6d # v7.2.0
        with:
          config: ".cspell.json"
          files: "**/*.{md,mdx}"
          inline: error
          incremental_files_only: false
