-
Notifications
You must be signed in to change notification settings - Fork 4
83 lines (71 loc) · 2.4 KB
/
Copy pathconfig-pilot.yml
File metadata and controls
83 lines (71 loc) · 2.4 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
name: V2Root-ConfigPilot
on:
schedule:
- cron: '0 */2 * * *' # Every 2 hours
workflow_dispatch:
jobs:
optimize-configs:
runs-on: ubuntu-latest
permissions:
contents: write # Grant write access to repository contents
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ github.token }} # Use built-in GITHUB_TOKEN
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install telethon
- name: Run FetchConfig.py
env:
TELEGRAM_SESSION_STRING: ${{ secrets.TELEGRAM_SESSION_STRING }}
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID }}
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
run: |
python3 FetchConfig.py --output configs.json
- name: Debug configs.json
run: |
cat configs.json
if: failure() # Only run if previous steps fail
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: Initialize Go module and install dependencies
run: |
if [ ! -f go.mod ]; then
go mod init github.com/v2root/configpilot
fi
go mod tidy
go mod download
cat go.mod # Debug: show go.mod after tidy
- name: Build and run ConfigPilot
env:
TEST_TIMEOUT: 10s
MAX_CONCURRENCY: 10
run: |
go build -o configpilot .
./configpilot
- name: Post best configs to Telegram
env:
TELEGRAM_SESSION_STRING: ${{ secrets.TELEGRAM_SESSION_STRING }}
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID }}
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
run: |
python3 PostBestConfigs.py
- name: Debug post_configs.log
run: |
cat Logs/post_configs.log || echo "No log file found"
if: failure()
- name: Commit and push results
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add output/BestConfigs.txt output/BestConfigs_scored.json
git commit -m "Update BestConfigs from scheduled run" || echo "No changes to commit"
git push