diff --git a/.gitea/workflows/update-rules.yml b/.gitea/workflows/update-rules.yml index 3e8f4b5..5501e98 100644 --- a/.gitea/workflows/update-rules.yml +++ b/.gitea/workflows/update-rules.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: 检出代码库 uses: actions/checkout@v4 with: token: ${{ secrets.WORKFLOW_TOKEN }} @@ -45,17 +45,17 @@ jobs: echo "=== 文件大小统计 ===" du -h ruleset/* + # 方案1:提交到仓库(推荐) - name: 提交规则文件到仓库 run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add ruleset/ - git diff --staged --quiet || git commit -m "Update clash rules - $(date +%Y-%m-%d)" - git push - env: - GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + git diff --staged --quiet || git commit -m "Auto update clash rules - $(date +%Y-%m-%d)" + git push https://x-access-token:${{ secrets.WORKFLOW_TOKEN }}@${{ github.server_url }}/${{ github.repository }}.git HEAD:main - - name: 上传规则文件 (备用) + # 方案2:上传为工件(如果需要保留原功能) + - name: 上传规则文件为工件 uses: actions/upload-artifact@v4 with: name: clash-rules-${{ github.run_number }}