Update all non-major dependencies #212
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate JSON Files | |
| on: | |
| push: | |
| branches: [main, develop] | |
| paths: | |
| - "**/*.json" | |
| pull_request: | |
| branches: [main, develop] | |
| paths: | |
| - "**/*.json" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate-json: | |
| runs-on: ubuntu-latest | |
| name: Validate JSON Files | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| - name: Validate JSON files | |
| run: | | |
| echo "π Finding JSON files..." | |
| json_files=$(find . -name "*.json" -not -path "./node_modules/*" -not -path "./.git/*" -not -path "./dist/*" -not -path "./.astro/*") | |
| if [ -z "$json_files" ]; then | |
| echo "βΉοΈ No JSON files found to validate" | |
| exit 0 | |
| fi | |
| echo "π Found JSON files:" | |
| echo "$json_files" | sed 's/^/ /' | |
| echo | |
| failed_files=() | |
| while IFS= read -r file; do | |
| echo "π Validating: $file" | |
| if node -e " | |
| try { | |
| const fs = require('fs'); | |
| const content = fs.readFileSync('$file', 'utf8'); | |
| JSON.parse(content); | |
| console.log('β Valid JSON'); | |
| } catch (error) { | |
| console.error('β Invalid JSON:', error.message); | |
| process.exit(1); | |
| } | |
| "; then | |
| echo " β $file is valid" | |
| else | |
| echo " β $file is invalid" | |
| failed_files+=("$file") | |
| fi | |
| done <<< "$json_files" | |
| if [ ${#failed_files[@]} -gt 0 ]; then | |
| echo | |
| echo "π₯ Validation failed for the following files:" | |
| printf ' %s\n' "${failed_files[@]}" | |
| exit 1 | |
| else | |
| echo | |
| echo "π All JSON files are valid!" | |
| fi | |
| - name: Validate translation files specifically | |
| run: | | |
| echo "π Validating translation files..." | |
| if [ ! -d "src/content/i18n" ]; then | |
| echo "βΉοΈ No translation directory found" | |
| exit 0 | |
| fi | |
| translation_files=$(find src/content/i18n -name "*.json" 2>/dev/null || true) | |
| if [ -z "$translation_files" ]; then | |
| echo "βΉοΈ No translation files found" | |
| exit 0 | |
| fi | |
| echo "π Found translation files:" | |
| echo "$translation_files" | sed 's/^/ /' | |
| echo | |
| failed_translations=() | |
| while IFS= read -r file; do | |
| echo "π Validating translation: $file" | |
| if node -e " | |
| try { | |
| const fs = require('fs'); | |
| const content = fs.readFileSync('$file', 'utf8'); | |
| const parsed = JSON.parse(content); | |
| // Additional checks for translation files | |
| if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) { | |
| throw new Error('Translation file must be a JSON object'); | |
| } | |
| // Check for empty translations | |
| const emptyKeys = Object.entries(parsed) | |
| .filter(([key, value]) => typeof value === 'string' && value.trim() === '') | |
| .map(([key]) => key); | |
| if (emptyKeys.length > 0) { | |
| console.warn('β οΈ Found empty translations:', emptyKeys.join(', ')); | |
| } | |
| console.log('β Valid translation file with', Object.keys(parsed).length, 'entries'); | |
| } catch (error) { | |
| console.error('β Invalid translation file:', error.message); | |
| process.exit(1); | |
| } | |
| "; then | |
| echo " β $file is valid" | |
| else | |
| echo " β $file is invalid" | |
| failed_translations+=("$file") | |
| fi | |
| done <<< "$translation_files" | |
| if [ ${#failed_translations[@]} -gt 0 ]; then | |
| echo | |
| echo "π₯ Translation validation failed for:" | |
| printf ' %s\n' "${failed_translations[@]}" | |
| exit 1 | |
| else | |
| echo | |
| echo "π All translation files are valid!" | |
| fi |