|
1 | 1 | name: 🧹 Cleanup Audit |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | | - branches: [ main, develop ] |
| 4 | + workflow_dispatch: |
6 | 5 | push: |
7 | 6 | branches: [ main, develop ] |
| 7 | + pull_request: |
| 8 | + branches: [ main, develop ] |
8 | 9 |
|
9 | 10 | jobs: |
10 | 11 | cleanup-audit: |
@@ -43,23 +44,34 @@ jobs: |
43 | 44 | run: | |
44 | 45 | python tools/inventory/redundant_score.py || echo 'path,inbound_imports,executed_lines,git_touches,days_since_last_change,looks_backup,in_registry,is_whitelisted,dupe_bucket,is_near_dupe,redundant_score' > artifacts/redundancy_report.csv |
45 | 46 | |
46 | | - - name: Check for backup files |
| 47 | + - name: Check for backup files (STRICT GATES) |
47 | 48 | run: | |
48 | | - echo "🔍 Checking for backup files..." |
| 49 | + echo "🔍 Checking for backup files with STRICT GATES..." |
49 | 50 | BACKUP_FILES=$(find . -name "*_backup.py" -o -name "*_old.py" -o -name "*_copy.py" -o -name "*_tmp.py" -o -name "*.py~" -o -name "*.py.save" | grep -v "_attic/" | grep -v ".git/" || true) |
50 | 51 | if [ -n "$BACKUP_FILES" ]; then |
51 | | - echo "❌ Found backup files (excluding _attic/):" |
| 52 | + echo "❌ FAIL: Found backup files (excluding _attic/):" |
52 | 53 | echo "$BACKUP_FILES" |
| 54 | + echo "🚫 These files are NOT ALLOWED in the main codebase!" |
| 55 | + echo "💡 Move them to _attic/ or delete them permanently." |
53 | 56 | exit 1 |
54 | 57 | else |
55 | | - echo "✅ No backup files found" |
| 58 | + echo "✅ No backup files found - STRICT GATES PASSED" |
56 | 59 | fi |
57 | 60 | |
58 | | - - name: Check for new unused near-duplicates |
| 61 | + - name: Check for new unused near-duplicates (ENHANCED) |
59 | 62 | run: | |
60 | | - echo "🔍 Checking for new unused near-duplicates..." |
61 | | - if [ -f "artifacts/near_dupes_baseline.json" ] && [ -f "artifacts/near_dupes.json" ]; then |
62 | | - echo "⚠️ Near-duplicate analysis completed. Review results in artifacts/near_dupes.json" |
| 63 | + echo "🔍 Checking for new unused near-duplicates with ENHANCED detection..." |
| 64 | + if [ -f "artifacts/baseline/near_dupes_baseline.json" ] && [ -f "artifacts/near_dupes.json" ]; then |
| 65 | + BASELINE_COUNT=$(jq '.near_dupe_clusters | length' artifacts/baseline/near_dupes_baseline.json 2>/dev/null || echo "0") |
| 66 | + CURRENT_COUNT=$(jq '.near_dupe_clusters | length' artifacts/near_dupes.json 2>/dev/null || echo "0") |
| 67 | + NEW_CLUSTERS=$((CURRENT_COUNT - BASELINE_COUNT)) |
| 68 | + if [ "$NEW_CLUSTERS" -gt 0 ]; then |
| 69 | + echo "⚠️ WARN: Found $NEW_CLUSTERS new near-duplicate clusters!" |
| 70 | + echo "📊 Baseline: $BASELINE_COUNT clusters, Current: $CURRENT_COUNT clusters" |
| 71 | + echo "🔍 Review artifacts/near_dupes.json for details" |
| 72 | + else |
| 73 | + echo "✅ No new near-duplicate clusters found" |
| 74 | + fi |
63 | 75 | else |
64 | 76 | echo "⚠️ No baseline found for near-duplicate comparison" |
65 | 77 | fi |
|
79 | 91 | fi |
80 | 92 | |
81 | 93 | - name: Upload artifacts |
82 | | - uses: actions/upload-artifact@v3 |
| 94 | + uses: actions/upload-artifact@v4 |
83 | 95 | if: always() |
84 | 96 | with: |
85 | 97 | name: cleanup-audit-artifacts |
|
0 commit comments