name: Check Characters

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  check:
    name: Check Characters
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 2
          ref: ${{ github.event.pull_request.head.sha }}
      - name: Get Changed Files
        id: changed-files
        uses: tj-actions/changed-files@v46
        with:
          files: |
            docs/**/*.md
            docs/**/*.tex
      - name: Setup Python
        if: steps.changed-files.outputs.any_changed == 'true'
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Check Changed Files
        if: steps.changed-files.outputs.any_changed == 'true'
        run: python scripts/check-characters.py
        env:
          CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
