This repository was archived by the owner on Jan 29, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate_structure.sh
More file actions
executable file
·116 lines (102 loc) · 3.23 KB
/
Copy pathvalidate_structure.sh
File metadata and controls
executable file
·116 lines (102 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
# HACS Validation Script
# This script validates that the repository structure is correct for HACS
echo "🔍 Validating HACS repository structure..."
echo ""
ERRORS=0
# Check required files at root
echo "Checking root files..."
for file in "hacs.json" "info.md" "README.md" "LICENSE"; do
if [ -f "$file" ]; then
echo " ✓ $file"
else
echo " ✗ $file - MISSING!"
ERRORS=$((ERRORS + 1))
fi
done
# Check custom_components structure
echo ""
echo "Checking custom_components/ista/..."
INTEGRATION_DIR="custom_components/ista"
if [ -d "$INTEGRATION_DIR" ]; then
echo " ✓ Directory exists"
# Check required integration files
for file in "__init__.py" "manifest.json" "sensor.py" "config_flow.py" "const.py" "api.py" "strings.json"; do
if [ -f "$INTEGRATION_DIR/$file" ]; then
echo " ✓ $file"
else
echo " ✗ $file - MISSING!"
ERRORS=$((ERRORS + 1))
fi
done
# Check translations
if [ -d "$INTEGRATION_DIR/translations" ]; then
echo " ✓ translations/"
if [ -f "$INTEGRATION_DIR/translations/en.json" ]; then
echo " ✓ en.json"
else
echo " ✗ en.json - MISSING!"
ERRORS=$((ERRORS + 1))
fi
else
echo " ✗ translations/ - MISSING!"
ERRORS=$((ERRORS + 1))
fi
else
echo " ✗ custom_components/ista/ - MISSING!"
ERRORS=$((ERRORS + 1))
fi
# Check .github structure
echo ""
echo "Checking .github/..."
if [ -f ".github/workflows/validate.yaml" ]; then
echo " ✓ workflows/validate.yaml"
else
echo " ⚠ workflows/validate.yaml - Missing (optional but recommended)"
fi
# Validate JSON files
echo ""
echo "Validating JSON syntax..."
for json_file in "hacs.json" "$INTEGRATION_DIR/manifest.json" "$INTEGRATION_DIR/strings.json" "$INTEGRATION_DIR/translations"/*.json; do
if [ -f "$json_file" ]; then
if python3 -m json.tool "$json_file" > /dev/null 2>&1; then
echo " ✓ $json_file"
else
echo " ✗ $json_file - INVALID JSON!"
ERRORS=$((ERRORS + 1))
fi
fi
done
# Check manifest.json specific requirements
echo ""
echo "Checking manifest.json requirements..."
if [ -f "$INTEGRATION_DIR/manifest.json" ]; then
# Check for required fields
for field in "domain" "name" "documentation" "requirements" "codeowners" "config_flow" "iot_class" "version"; do
if grep -q "\"$field\"" "$INTEGRATION_DIR/manifest.json"; then
echo " ✓ Field: $field"
else
echo " ✗ Field: $field - MISSING!"
ERRORS=$((ERRORS + 1))
fi
done
# Check for placeholder values
if grep -q "GITHUB_USERNAME\|yourusername" "$INTEGRATION_DIR/manifest.json"; then
echo " ✗ Contains placeholder values (GITHUB_USERNAME or yourusername)"
ERRORS=$((ERRORS + 1))
else
echo " ✓ No placeholder values found"
fi
fi
# Summary
echo ""
echo "================================"
if [ $ERRORS -eq 0 ]; then
echo "✅ All checks passed!"
echo "Repository is ready for HACS"
exit 0
else
echo "❌ Found $ERRORS error(s)"
echo "Please fix the issues above before publishing"
exit 1
fi