Sfoglia il codice sorgente

Add find-missing-translations as a CI check

Matt Rubens 9 mesi fa
parent
commit
61339ee855
2 ha cambiato i file con 17 aggiunte e 0 eliminazioni
  1. 15 0
      .github/workflows/code-qa.yml
  2. 2 0
      scripts/find-missing-translations.js

+ 15 - 0
.github/workflows/code-qa.yml

@@ -28,6 +28,21 @@ jobs:
       - name: Lint
         run: npm run lint
 
+  check-translations:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
+      - name: Setup Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: '18'
+          cache: 'npm'
+      - name: Install dependencies
+        run: npm run install:all
+      - name: Verify all translations are complete
+        run: node scripts/find-missing-translations.js
+
   knip:
     runs-on: ubuntu-latest
     steps:

+ 2 - 0
scripts/find-missing-translations.js

@@ -206,6 +206,8 @@ function findMissingTranslations() {
 			console.log("1. Add the missing keys to the corresponding locale files")
 			console.log("2. Translate the English values to the appropriate language")
 			console.log("3. Run this script again to verify all translations are complete")
+			// Exit with error code to fail CI checks
+			process.exit(1)
 		}
 	} catch (error) {
 		console.error("Error:", error.message)