Merge branch 'main' of https://github.com/webdev-sam/webdevsam.io #1
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: CI - Validate Site | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Validate HTML files | |
| run: | | |
| echo "Checking for HTML syntax issues..." | |
| find . -name "*.html" -type f ! -path "*/.*" | while read file; do | |
| echo "Checking $file" | |
| # Basic HTML validation - check for common issues | |
| if ! grep -q "<!DOCTYPE html>" "$file" 2>/dev/null; then | |
| echo "⚠️ Warning: $file missing DOCTYPE declaration" | |
| fi | |
| done | |
| echo "✓ HTML validation complete" | |
| - name: Check for sensitive data | |
| run: | | |
| echo "Scanning for potential sensitive data..." | |
| # Check for common sensitive patterns (excluding this check itself) | |
| if grep -r -i "password" --include="*.html" --include="*.js" --exclude-dir=".git" --exclude-dir=".github" . | grep -v "type=\"password\"" | grep -v "placeholder" | grep -v "Password" | grep -v "github/workflows"; then | |
| echo "⚠️ Warning: Found 'password' references - please review" | |
| fi | |
| if grep -r -i "api[_-]key" --include="*.html" --include="*.js" --exclude-dir=".git" --exclude-dir=".github" .; then | |
| echo "❌ Error: Found potential API keys in code" | |
| exit 1 | |
| fi | |
| if grep -r -i "secret" --include="*.html" --include="*.js" --exclude-dir=".git" --exclude-dir=".github" . | grep -v "secrets." | grep -v "github/workflows"; then | |
| echo "⚠️ Warning: Found 'secret' references - please review" | |
| fi | |
| echo "✓ Sensitive data check complete" | |
| - name: Validate links structure | |
| run: | | |
| echo "Checking for broken internal links..." | |
| # Check that referenced pages exist | |
| for page in index.html pages/home.html pages/blog.html pages/work.html pages/services.html pages/contact.html pages/404.html; do | |
| if [ -f "$page" ]; then | |
| echo "✓ Found $page" | |
| else | |
| echo "❌ Missing $page" | |
| exit 1 | |
| fi | |
| done | |
| echo "✓ Link structure validation complete" | |
| - name: Check file sizes | |
| run: | | |
| echo "Checking for large files..." | |
| find . -type f ! -path "*/.*" -size +5M -exec ls -lh {} \; | awk '{print "⚠️ Large file: " $9 " (" $5 ")"}' | |
| echo "✓ File size check complete" |