Files

51 lines
1.2 KiB
YAML

name: Translation Lint
on:
pull_request:
paths:
- 'src/duckstation-qt/translations/*.ts'
push:
branches:
- master
- dev
paths:
- 'src/duckstation-qt/translations/*.ts'
workflow_dispatch:
permissions:
contents: read
jobs:
translation-lint:
runs-on: ubuntu-slim
timeout-minutes: 120
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check Translation Placeholders
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
if [[ "$EVENT_NAME" == "pull_request" ]]; then
mapfile -t files < <(
git diff --name-only --diff-filter=ACMRT "$BASE_SHA...$HEAD_SHA" -- \
'src/duckstation-qt/translations/*.ts'
)
else
files=(src/duckstation-qt/translations/*.ts)
fi
if (( ${#files[@]} == 0 )); then
echo "No translation files to validate."
exit 0
fi
for file in "${files[@]}"; do
python scripts/translation/validate_ts.py "$file"
done