-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (117 loc) · 4.66 KB
/
run_checker.yml
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Run checker
on:
schedule:
- cron: "*/30 * * * *"
timezone: Asia/Shanghai # 添加时区配置
workflow_dispatch:
jobs:
run-checkers:
runs-on: ubuntu-latest
env:
TZ: Asia/Shanghai # 设置为你本地的时区
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install telethon python-dotenv pathlib2
- name: Set up environment variables
run: |
touch .env
echo "API_ID=${{ secrets.API_ID }}" >> .env
echo "API_HASH=${{ secrets.API_HASH }}" >> .env
echo "SESSION_NAME=${{ secrets.SESSION_NAME }}" >> .env
echo "TELEGRAM_BOT_TOKEN=${{ secrets.TELEGRAM_BOT_TOKEN }}" >> .env
echo "TELEGRAM_CHAT_ID=${{ secrets.TELEGRAM_CHAT_ID }}" >> .env
echo "CLOUDFLARE_API_KEY=${{ secrets.CLOUDFLARE_API_KEY }}" >> .env
echo "CLOUDFLARE_EMAIL=${{ secrets.CLOUDFLARE_EMAIL }}" >> .env
echo "CLOUDFLARE_ZONE_ID=${{ secrets.CLOUDFLARE_ZONE_ID }}" >> .env
echo "TELEGRAM_PROXY=${{ secrets.TELEGRAM_PROXY }}" >> .env
- name: 检查时间
run: |
echo "UTC 时间: $(date -u)"
echo "本地时间(Runner 默认): $(date)"
echo "自定义时区时间: $(TZ=Asia/Shanghai date)"
- name: IP health check and auto-update
run: |
python ip_checker.py
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet port/ip.txt; then
git status
echo "No changes to commit."
else
git status
git add .
git commit -m "cfst: Auto-update port/ip.txt on $(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S')" # 添加时区参数
git push origin main
git log -1 --stat origin/main
fi
- name: Proxy health check and auto-update
run: |
python proxy_checker.py
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet port/fd.txt; then
git status
echo "No changes to commit."
else
git status
git add .
git commit -m "cfst: Auto-update port/fd.txt on $(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S')" # 添加时区参数
git push origin main
git log -1 --stat origin/main
fi
- name: Run tcip checker
run: |
python checker.py port/tcip.txt
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet port/tcip.txt; then
git status
echo "No changes to commit."
else
git status
git add .
git commit -m "cfst: Auto-update port/tcip.txt on $(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S')" # 添加时区参数
git push origin main
git log -1 --stat origin/main
fi
- name: Run cfip checker
run: |
python checker.py speed/cfip.txt
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet speed/cfip.txt; then
git status
echo "No changes to commit."
else
git status
git add .
git commit -m "cfst: Auto-update speed/cfip.txt on $(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S')" # 添加时区参数
git push origin main
git log -1 --stat origin/main
fi
- name: Run speed/ip checker
run: |
python checker.py speed/ip.txt
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet speed/ip.txt; then
git status
echo "No changes to commit."
else
git status
git add .
git commit -m "cfst: Auto-update speed/ip.txt on $(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S')" # 添加时区参数
git push origin main
git log -1 --stat origin/main
fi