From 965febc5ef5e60ad387bb264098fcdfada399b4f Mon Sep 17 00:00:00 2001 From: adminroot Date: Thu, 11 Sep 2025 23:28:04 -0700 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.gitea/workflows/update-ru?= =?UTF-8?q?les.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/update-rules.yml | 62 +++++++++++++++---------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/.gitea/workflows/update-rules.yml b/.gitea/workflows/update-rules.yml index 084a612..8788df2 100644 --- a/.gitea/workflows/update-rules.yml +++ b/.gitea/workflows/update-rules.yml @@ -1,41 +1,39 @@ -name: Push测试调试 +name: 更新数据文件 + on: - push: - branches: [ main, master ] - pull_request: - branches: [ main, master ] + schedule: + - cron: '0 2 * * *' # 每天凌晨2点 + workflow_dispatch: jobs: - test: + update-data: runs-on: ubuntu-latest steps: - - name: 检查环境信息 + - uses: actions/checkout@v3 + + - name: 配置Git run: | - echo "===== 环境信息 =====" - echo "Runner OS: ${{ runner.os }}" - echo "仓库: ${{ github.repository }}" - echo "分支: ${{ github.ref }}" - echo "提交SHA: ${{ github.sha }}" - echo "触发者: ${{ github.actor }}" - echo "工作目录: $(pwd)" - - - name: Checkout代码 - uses: actions/checkout@v3 - with: - fetch-depth: 0 # 获取完整历史 - - - name: 验证checkout结果 + git config user.email "data@gitea.local" + git config user.name "Data Bot" + + - name: 下载并处理数据 run: | - echo "===== 文件列表 =====" - ls -la - echo "===== Git状态 =====" - git status - echo "===== Git日志 =====" - git log --oneline -5 + mkdir -p data - - name: 运行测试 + # 下载CSV数据 + 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: | - echo "===== 开始测试 =====" - # 这里添加您的实际测试命令 - echo "测试通过" - exit 0 # 确保返回成功状态码 \ No newline at end of file + 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 \ No newline at end of file