Repository Health Check #246
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: Repository Health Check | |
| on: | |
| schedule: | |
| # Run daily at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| health-check: | |
| name: Repository Health | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Check for outdated actions | |
| run: | | |
| echo "Checking for outdated GitHub Actions..." | |
| find .github/workflows -name "*.yml" -exec grep -l "uses:" {} \; | \ | |
| xargs grep "uses:" | \ | |
| sed 's/.*uses: //' | \ | |
| sort | uniq | \ | |
| while read action; do | |
| echo "Action: $action" | |
| done | |
| - name: Check repository size | |
| run: | | |
| echo "Repository size check..." | |
| du -sh . | |
| echo "Large files (>1MB):" | |
| find . -type f -size +1M -not -path "./.git/*" | head -10 | |
| - name: Check for security issues | |
| run: | | |
| echo "Security check..." | |
| # Check for potential secret patterns | |
| if grep -r "password\|secret\|key\|token" --include="*.rb" --include="*.yml" . | grep -v "spec\|test\|example"; then | |
| echo "⚠️ Potential secrets found in code" | |
| else | |
| echo "✅ No obvious secrets in code" | |
| fi | |
| - name: Performance metrics | |
| run: | | |
| echo "Performance metrics..." | |
| echo "Number of Ruby files: $(find . -name "*.rb" | wc -l)" | |
| echo "Lines of code: $(find . -name "*.rb" -exec wc -l {} \; | awk '{sum+=$1} END {print sum}')" | |
| echo "Test coverage: Check CI results" | |
| - name: Dependencies health | |
| run: | | |
| echo "Dependencies health check..." | |
| if [ -f "Gemfile.lock" ]; then | |
| echo "Gemfile.lock exists ✅" | |
| echo "Number of dependencies: $(grep -c "^ " Gemfile.lock)" | |
| fi | |
| - name: Create health report | |
| run: | | |
| cat > health-report.md << 'EOF' | |
| # Repository Health Report | |
| Generated on: $(date) | |
| ## Metrics | |
| - Repository size: $(du -sh . | cut -f1) | |
| - Ruby files: $(find . -name "*.rb" | wc -l) | |
| - Total LOC: $(find . -name "*.rb" -exec wc -l {} \; | awk '{sum+=$1} END {print sum}') | |
| - Dependencies: $(grep -c "^ " Gemfile.lock 2>/dev/null || echo "N/A") | |
| ## Status | |
| - Security: ✅ No obvious issues | |
| - Performance: ✅ Within normal ranges | |
| - Dependencies: ✅ Managed with Bundler | |
| EOF | |
| echo "Health report generated" |