From 5bb99f941c88432fdc23cebd314d6212743247f3 Mon Sep 17 00:00:00 2001 From: zenobit Date: Mon, 30 Mar 2026 05:10:23 +0200 Subject: [PATCH] fix(ci): fix jq command with -R raw input flag - Also fix quick_check to only fail on missing keys (not untranslated) - Use compact JSON for GITHUB_OUTPUT --- .github/workflows/ci.yml | 41 +++++++++++++++++++++++++++++++++ scripts/validate_translation.py | 3 ++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d009ac268..91bc28e570 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,47 @@ jobs: - run: npm run typecheck:core - run: npm run typecheck:noimplicit:core + i18n: + name: i18n Validation + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + lang: ${{ fromJson(needs.i18n-matrix.outputs.langs) }} + needs: i18n-matrix + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Validate ${{ matrix.lang }} + run: | + echo "Validating language: ${{ matrix.lang }}" + python3 scripts/validate_translation.py quick -l '${{ matrix.lang }}' + - name: Report to summary + if: always() + run: | + echo "### ${{ matrix.lang }} Translation Report" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + python3 scripts/validate_translation.py quick -l '${{ matrix.lang }}' >> $GITHUB_STEP_SUMMARY 2>&1 + echo '```' >> $GITHUB_STEP_SUMMARY + + i18n-matrix: + name: Build language matrix + runs-on: ubuntu-latest + outputs: + langs: ${{ steps.langs.outputs.langs }} + steps: + - uses: actions/checkout@v4 + - name: Generate language list + id: langs + run: | + LANG_DIR="src/i18n/messages" + LANGS=$(ls "$LANG_DIR"/*.json | xargs -n1 basename | sed 's/.json$//' | grep -v '^en$' | jq -R . | jq -s .) + echo "langs=${LANGS}" >> $GITHUB_OUTPUT + echo "Found languages:" + echo "$LANGS" + security: name: Security Audit runs-on: ubuntu-latest diff --git a/scripts/validate_translation.py b/scripts/validate_translation.py index 5d1a4a386d..9c76d83cfd 100755 --- a/scripts/validate_translation.py +++ b/scripts/validate_translation.py @@ -396,7 +396,8 @@ def quick_check() -> int: print(f"Missing: {len(missing)}") print(f"Untranslated: {len(untranslated)}") - return 0 if not missing and not untranslated else 1 + # Only fail on missing keys, untranslated is acceptable + return 0 if not missing else 1 def show_diff(category: str) -> int: