Skip to content

Commit 8ccd6ba

Browse files
okjodomSusanGithaigaN
authored andcommitted
feat: validate project links on publish
add Zap website link update zap website link
1 parent c467805 commit 8ccd6ba

File tree

2 files changed

+63
-4
lines changed

2 files changed

+63
-4
lines changed

.github/workflows/deploy.yml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Validate JSON structure
2828
run: |
2929
echo "🔍 Validating JSON syntax..."
30-
python -m json.tool lngal_data.json > /dev/null
30+
python3 -m json.tool lngal_data.json > /dev/null
3131
echo "✅ JSON syntax is valid"
3232
3333
echo "🔍 Checking required fields..."
@@ -38,7 +38,7 @@ jobs:
3838
fi
3939
4040
# Check that there's at least one category
41-
category_count=$(python -c "import json; data=json.load(open('lngal_data.json')); print(len(data.get('categories', [])))")
41+
category_count=$(python3 -c "import json; data=json.load(open('lngal_data.json')); print(len(data.get('categories', [])))")
4242
if [ "$category_count" -eq 0 ]; then
4343
echo "❌ No categories found in JSON"
4444
exit 1
@@ -47,6 +47,56 @@ jobs:
4747
echo "✅ Found $category_count categories"
4848
echo "✅ JSON structure validation passed"
4949
50+
- name: Validate project links
51+
run: |
52+
echo "🔍 Validating project links format..."
53+
python3 -c "
54+
import json
55+
import sys
56+
57+
with open('lngal_data.json', 'r') as f:
58+
data = json.load(f)
59+
60+
errors = []
61+
total_links = 0
62+
63+
for category in data.get('categories', []):
64+
for item in category.get('items', []):
65+
project_name = item.get('project_name', 'Unknown')
66+
links = item.get('links', [])
67+
68+
for i, link in enumerate(links):
69+
total_links += 1
70+
# Check if link is an object
71+
if not isinstance(link, dict):
72+
errors.append(f'❌ {project_name}: Link {i+1} is not an object')
73+
continue
74+
# Check required fields
75+
if 'type' not in link:
76+
errors.append(f'❌ {project_name}: Link {i+1} missing \"type\" field')
77+
elif not isinstance(link['type'], str) or not link['type'].strip():
78+
errors.append(f'❌ {project_name}: Link {i+1} \"type\" field is empty or not a string')
79+
80+
if 'url' not in link:
81+
errors.append(f'❌ {project_name}: Link {i+1} missing \"url\" field')
82+
elif not isinstance(link['url'], str) or not link['url'].strip():
83+
errors.append(f'❌ {project_name}: Link {i+1} \"url\" field is empty or not a string')
84+
else:
85+
url = link['url'].strip()
86+
# Basic URL format validation
87+
if not (url.startswith('http://') or url.startswith('https://')):
88+
errors.append(f'❌ {project_name}: Link {i+1} URL must start with http:// or https://')
89+
90+
if errors:
91+
print(f'Found {len(errors)} link validation errors:')
92+
for error in errors:
93+
print(error)
94+
sys.exit(1)
95+
else:
96+
print(f'✅ All {total_links} project links are properly formatted')
97+
"
98+
echo "✅ Project links validation passed"
99+
50100
- name: Test HTML validity
51101
run: |
52102
echo "🔍 Checking HTML structure..."

lngal_data.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,17 @@
237237
{
238238
"project_name": "Zap",
239239
"project_level": "Non-Custodial Wallet",
240-
"links": [],
241-
"tags": ["Non-Custodial", "Connects to own node"]
240+
"links": [
241+
{
242+
"type": "Website",
243+
"url": "http://zaphq.io/"
244+
},
245+
{
246+
"type": "GitHub",
247+
"url": "https://github.com/ln-zap"
248+
}
249+
],
250+
"tags": ["Non-Custodial", "Connects to own node", "Depracated"]
242251
},
243252
{
244253
"project_name": "Electrum",

0 commit comments

Comments
 (0)