From 55fc2b2bc82e48f23b15324dc720acfb67d4c42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Theod=C3=B3r=20T=C3=B3mas?= Date: Fri, 20 Feb 2026 17:48:44 +0700 Subject: [PATCH] chore: removing i18n from pre-commit hook (#7318) --- .github/workflows/translation-check.yml | 42 ++++++++++++------------- .husky/pre-commit | 41 +----------------------- 2 files changed, 21 insertions(+), 62 deletions(-) diff --git a/.github/workflows/translation-check.yml b/.github/workflows/translation-check.yml index 30e90872ec..217991778e 100644 --- a/.github/workflows/translation-check.yml +++ b/.github/workflows/translation-check.yml @@ -6,19 +6,9 @@ permissions: on: pull_request: types: [opened, synchronize, reopened] - paths: - - "apps/web/**/*.ts" - - "apps/web/**/*.tsx" - - "apps/web/locales/**/*.json" - - "scan-translations.ts" push: branches: - main - paths: - - "apps/web/**/*.ts" - - "apps/web/**/*.tsx" - - "apps/web/locales/**/*.json" - - "scan-translations.ts" jobs: validate-translations: @@ -33,30 +23,38 @@ jobs: egress-policy: audit - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Check for relevant changes + id: changes + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + filters: | + translations: + - 'apps/web/**/*.ts' + - 'apps/web/**/*.tsx' + - 'apps/web/locales/**/*.json' + - 'packages/surveys/src/**/*.{ts,tsx}' + - 'packages/surveys/locales/**/*.json' + - 'packages/email/**/*.{ts,tsx}' - name: Setup Node.js 22.x + if: steps.changes.outputs.translations == 'true' uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af with: node-version: 22.x - name: Install pnpm + if: steps.changes.outputs.translations == 'true' uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Install dependencies + if: steps.changes.outputs.translations == 'true' run: pnpm install --config.platform=linux --config.architecture=x64 - name: Validate translation keys - run: | - echo "" - echo "🔍 Validating translation keys..." - echo "" - pnpm run scan-translations + if: steps.changes.outputs.translations == 'true' + run: pnpm run scan-translations - - name: Summary - if: success() - run: | - echo "" - echo "✅ Translation validation completed successfully!" - echo "" + - name: Skip (no translation-related changes) + if: steps.changes.outputs.translations != 'true' + run: echo "No translation-related files changed — skipping validation." diff --git a/.husky/pre-commit b/.husky/pre-commit index a88bfb1c05..e02c24e2b5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,40 +1 @@ -# Load environment variables from .env files -if [ -f .env ]; then - set -a - . .env - set +a -fi - -pnpm lint-staged - -# Run Lingo.dev i18n workflow if LINGODOTDEV_API_KEY is set -if [ -n "$LINGODOTDEV_API_KEY" ]; then - echo "" - echo "🌍 Running Lingo.dev translation workflow..." - echo "" - - # Run translation generation and validation - if pnpm run i18n; then - echo "" - echo "✅ Translation validation passed" - echo "" - # Add updated locale files to git - git add apps/web/locales/*.json - else - echo "" - echo "❌ Translation validation failed!" - echo "" - echo "Please fix the translation issues above before committing:" - echo " • Add missing translation keys to your locale files" - echo " • Remove unused translation keys" - echo "" - echo "Or run 'pnpm i18n' to see the detailed report" - echo "" - exit 1 - fi -else - echo "" - echo "⚠️ Skipping translation validation: LINGODOTDEV_API_KEY is not set" - echo " (This is expected for community contributors)" - echo "" -fi \ No newline at end of file +pnpm lint-staged \ No newline at end of file