Run checker #293
This file contains 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: 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 |