-
Notifications
You must be signed in to change notification settings - Fork 3
109 lines (102 loc) · 4.26 KB
/
Copy pathauto-scanner.yml
File metadata and controls
109 lines (102 loc) · 4.26 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
# =============================================================================
# RebelDev Auto Scanner - GitHub Actions Workflow
# =============================================================================
name: "🚀 RebelDev - Auto Config Scanner"
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
inputs:
force_refresh:
description: 'Force refresh all configurations'
required: false
default: false
type: boolean
push:
branches: [ main ]
env:
PYTHON_VERSION: '3.12'
SCANNER_VERSION: '4.8.0'
jobs:
improved-scan-and-deploy:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: "🔄 Checkout Repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "🐍 Setup Python"
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: "📦 Install Dependencies"
run: |
python -m pip install --upgrade pip
pip install aiohttp requests
- name: "🔧 Setup System Permissions"
run: |
sudo sysctl -w net.ipv4.ping_group_range="0 2147483647" || true
sudo apt-get update && sudo apt-get install -y curl || true
- name: "🧹 Clean Cache"
run: |
rm -rf RebelLink || true
- name: "🚀 Run Scanner"
run: |
echo "Starting scan v${{ env.SCANNER_VERSION }}..."
timeout 40m python auto_scanner.py
- name: "✅ Validate Output"
run: |
echo "Validating generated configurations..."
if [ -d "RebelLink" ]; then
sub_count=$(find RebelLink -name "*_subscriptions.txt" -type f | wc -l)
echo "Found $sub_count subscription files"
if [ -f "RebelLink/performance_report.json" ]; then
echo 'import json' > validate_report.py
echo 'try:' >> validate_report.py
echo ' with open("RebelLink/performance_report.json") as f:' >> validate_report.py
echo ' r = json.load(f)' >> validate_report.py
echo ' print("✅ Scan completed: " + r["scan_timestamp"])' >> validate_report.py
echo ' print("📋 Processed: " + str(r["performance_metrics"]["total_processed"]))' >> validate_report.py
echo ' print("✅ Valid: " + str(r["performance_metrics"]["valid_configs"]))' >> validate_report.py
echo ' print("📊 Success rate: " + str(r["performance_metrics"]["success_rate"]) + "%")' >> validate_report.py
echo ' print("⚡ Avg Latency: " + str(r["performance_metrics"]["avg_latency_ms"]) + "ms")' >> validate_report.py
echo ' print("⭐ Avg Score: " + str(r["performance_metrics"]["avg_score"]))' >> validate_report.py
echo 'except Exception as e:' >> validate_report.py
echo ' print("⚠️ Report read error: " + str(e))' >> validate_report.py
python validate_report.py
rm validate_report.py
else
echo "⚠️ performance_report.json not found"
exit 1
fi
else
echo "❌ RebelLink folder missing"
exit 1
fi
echo "✅ Validation passed"
- name: "🔄 Deploy Configurations"
run: |
git config --local user.email "action@github.com"
git config --local user.name "RebelDev Improved Scanner"
if git diff --quiet HEAD -- RebelLink/; then
echo "🟡 No configuration changes detected"
else
git add RebelLink/
valid_count=$(python -c "import json; d=json.load(open('RebelLink/performance_report.json')); print(d['performance_metrics']['valid_configs'])")
timestamp=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
git commit -m "🤖 Auto-Update: ${timestamp}" \
-m "v${{ env.SCANNER_VERSION }} - ${valid_count} valid configs"
git push
fi
- name: "📤 Upload Artifacts"
if: always()
uses: actions/upload-artifact@v4
with:
name: rebeldev-scan-results
path: |
RebelLink/
scanner.log
retention-days: 7
if-no-files-found: ignore