更新 .gitea/workflows/update-rules.yml
This commit is contained in:
@@ -1,41 +1,39 @@
|
|||||||
name: Push测试调试
|
name: 更新数据文件
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
schedule:
|
||||||
branches: [ main, master ]
|
- cron: '0 2 * * *' # 每天凌晨2点
|
||||||
pull_request:
|
workflow_dispatch:
|
||||||
branches: [ main, master ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
update-data:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 检查环境信息
|
- uses: actions/checkout@v3
|
||||||
run: |
|
|
||||||
echo "===== 环境信息 ====="
|
|
||||||
echo "Runner OS: ${{ runner.os }}"
|
|
||||||
echo "仓库: ${{ github.repository }}"
|
|
||||||
echo "分支: ${{ github.ref }}"
|
|
||||||
echo "提交SHA: ${{ github.sha }}"
|
|
||||||
echo "触发者: ${{ github.actor }}"
|
|
||||||
echo "工作目录: $(pwd)"
|
|
||||||
|
|
||||||
- name: Checkout代码
|
- name: 配置Git
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0 # 获取完整历史
|
|
||||||
|
|
||||||
- name: 验证checkout结果
|
|
||||||
run: |
|
run: |
|
||||||
echo "===== 文件列表 ====="
|
git config user.email "data@gitea.local"
|
||||||
ls -la
|
git config user.name "Data Bot"
|
||||||
echo "===== Git状态 ====="
|
|
||||||
git status
|
|
||||||
echo "===== Git日志 ====="
|
|
||||||
git log --oneline -5
|
|
||||||
|
|
||||||
- name: 运行测试
|
- name: 下载并处理数据
|
||||||
run: |
|
run: |
|
||||||
echo "===== 开始测试 ====="
|
mkdir -p data
|
||||||
# 这里添加您的实际测试命令
|
|
||||||
echo "测试通过"
|
# 下载CSV数据
|
||||||
exit 0 # 确保返回成功状态码
|
curl -L -o data/google.txt \
|
||||||
|
"https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt"
|
||||||
|
|
||||||
|
# 添加时间戳
|
||||||
|
date '+%Y-%m-%d %H:%M:%S' > data/LAST_UPDATE
|
||||||
|
|
||||||
|
- name: 提交数据更新
|
||||||
|
run: |
|
||||||
|
git add data/
|
||||||
|
if ! git diff --cached --quiet; then
|
||||||
|
TIMESTAMP=$(date '+%Y-%m-%d')
|
||||||
|
git commit -m "📊 Data update for ${TIMESTAMP}"
|
||||||
|
git push
|
||||||
|
else
|
||||||
|
echo "No data changes detected"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user