name: i18n QA

on:
  pull_request:
    branches: [main]
    paths:
      - 'README*.md'
      - 'wiki/**/*.md'
      - 'scripts/i18n/**'
      - '.github/workflows/i18n-qa.yml'
  workflow_dispatch:

permissions: read-all

jobs:
  i18n-qa:
    name: Translation Integrity Checks
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 0
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
        with:
          python-version: '3.12'
      - name: Run i18n QA
        run: python scripts/i18n/qa_check.py

      - name: Check markdown links (README/wiki)
        run: |
          if [ "${{ github.event_name }}" = "pull_request" ]; then
            python scripts/i18n/link_check.py --changed-only --base-ref "origin/${{ github.base_ref }}"
          else
            python scripts/i18n/link_check.py
          fi
