Files
templates/.github/workflows/validate-meta.yml
Jainil Prajapati 🪐 8142693922 The meta.json glow-up nobody saw coming (#281)
* removed

n8n (appears 2 times)
Authelia (appears 2 times)
SupaBase (appears 2 times)
Livekit (appears 2 times)
WG-Easy (appears 2 times)
Open Notebook (appears 2 times)
Booklore (appears 2 times)
Scrypted (appears 2 times)
Wallos (appears 2 times)
Statping-NG (appears 2 times)

* Replace application catalog entries with new software entries

* Test 1

* Updated Scripts

* Final Test

* Fix

* Remove redundant dependency installation steps from GitHub Actions workflow

* Test 2

* Update meta sorting logic to ASCII order and add --backup option for deduplication

* Fix meta.json: Remove duplicates and apply correct ASCII sorting

- Remove duplicate entries: scrypted, searxng (243 → 241 entries)
- Fix sorting algorithm to use ASCII order for CI/CD compatibility
- Update both dedupe-and-sort-meta.js and build-scripts/process-meta.js
- Add missing --backup CLI argument to build script
- Ensure consistent sorting across all processing interfaces

* Fix CI/CD pipeline: Count JSON entries instead of lines

- Update validate-meta.yml to count JSON entries using Node.js instead of wc -l
- Add custom JSON formatting functions to both processing scripts
- Ensure consistent output formatting across all processing interfaces
- Fix false positive where line count increased due to expanded JSON formatting

The CI/CD failure was caused by counting file lines (4124) instead of actual
JSON entries (241). Both files now produce identical results with proper
entry counting in the validation workflow.

* Fix meta.json formatting to match processing script output

- Apply consistent JSON formatting to meta.json using processing script
- Ensure file formatting matches expected CI/CD workflow output
- Files now pass diff comparison in validation workflow

This resolves the CI/CD pipeline failure where files had identical content
but different formatting, causing diff validation to fail.

* Test 3

* Removed duplicate and action worked :)

* Remove pull_request_template.md

* Remove duplicate meta entries to prevent processing conflicts

---------

Co-authored-by: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com>
2025-08-16 00:20:14 -06:00

81 lines
2.8 KiB
YAML

name: Validate and Process Meta.json
on:
push:
branches: [main, master, develop]
paths: ["meta.json"]
pull_request:
branches: [main, master]
paths: ["meta.json"]
workflow_dispatch:
jobs:
validate-meta:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Validate meta.json structure
run: |
echo "🔍 Validating meta.json structure..."
node -e "
const fs = require('fs');
const data = JSON.parse(fs.readFileSync('meta.json', 'utf8'));
if (!Array.isArray(data)) throw new Error('meta.json must be an array');
console.log('✅ meta.json structure is valid');
console.log('📊 Found', data.length, 'entries');
"
- name: Check for duplicates and sort order
run: |
echo "🔍 Checking for duplicates and sort order..."
node build-scripts/process-meta.js --verbose --output /tmp/meta-test.json
- name: Compare with original
run: |
echo "🔍 Comparing processed file with original..."
if ! diff -q meta.json /tmp/meta-test.json > /dev/null; then
echo "⚠️ meta.json needs processing (duplicates found or not sorted)"
echo "Original entries:"
node -e "console.log(JSON.parse(require('fs').readFileSync('meta.json', 'utf8')).length)"
echo "Processed entries:"
node -e "console.log(JSON.parse(require('fs').readFileSync('/tmp/meta-test.json', 'utf8')).length)"
echo ""
echo "To fix this, run: npm run process-meta"
exit 1
else
echo "✅ meta.json is properly deduplicated and sorted"
fi
- name: Validate required fields
run: |
echo "🔍 Validating required fields..."
node -e "
const fs = require('fs');
const data = JSON.parse(fs.readFileSync('meta.json', 'utf8'));
const required = ['id', 'name', 'version', 'description', 'links', 'logo', 'tags'];
let issues = 0;
data.forEach((item, index) => {
const missing = required.filter(field => !item[field]);
if (missing.length > 0) {
console.log('❌ Entry', index, '(' + item.id + '):', 'Missing fields:', missing.join(', '));
issues++;
}
});
if (issues > 0) {
console.log('🚨 Found', issues, 'entries with missing required fields');
process.exit(1);
} else {
console.log('✅ All entries have required fields');
}
"