Added wiki generator

This commit is contained in:
AB from home.homenet
2025-09-16 16:13:26 +03:00
parent eb3b5183b0
commit 9dd761bc8e

View File

@@ -66,7 +66,7 @@ jobs:
echo "🔍 Validating and extracting JSON..." echo "🔍 Validating and extracting JSON..."
if python3 -c "import json; f=open('terraform-output.json'); data=json.load(f); f.close(); print('✅ Valid JSON')" 2>/dev/null; then if python3 -c "import json; f=open('terraform-output.json'); data=json.load(f); f.close(); print('✅ Valid JSON')" 2>/dev/null; then
# Extract just the value field using Python (more reliable than jq) # Extract just the value field using Python (more reliable than jq)
python3 -c " cat > extract_value.py << 'EOF'
import json import json
with open('terraform-output.json', 'r') as f: with open('terraform-output.json', 'r') as f:
data = json.load(f) data = json.load(f)
@@ -77,13 +77,14 @@ with open('terraform-output.json', 'r') as f:
value = data value = data
with open('terraform-output-value.json', 'w') as out: with open('terraform-output-value.json', 'w') as out:
json.dump(value, out, indent=2) json.dump(value, out, indent=2)
" EOF
python3 extract_value.py
mv terraform-output-value.json terraform-output.json mv terraform-output-value.json terraform-output.json
echo "✅ JSON extracted successfully" echo "✅ JSON extracted successfully"
else else
echo "❌ Invalid JSON detected, trying to fix..." echo "❌ Invalid JSON detected, trying to fix..."
# Try to extract valid JSON part # Try to extract valid JSON part
python3 -c " cat > fix_json.py << 'EOF'
import json import json
import re import re
@@ -121,7 +122,8 @@ try:
print('❌ No JSON found in output') print('❌ No JSON found in output')
except Exception as e: except Exception as e:
print(f'❌ Failed to fix JSON: {e}') print(f'❌ Failed to fix JSON: {e}')
" EOF
python3 fix_json.py
fi fi
# Debug output # Debug output