更新 .gitea/workflows/update-rules.yml
Some checks failed
Download Clash Rules / download-rules (push) Failing after 49s
Some checks failed
Download Clash Rules / download-rules (push) Failing after 49s
This commit is contained in:
@@ -13,8 +13,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 检出代码
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.WORKFLOW_TOKEN }}
|
token: ${{ secrets.WORKFLOW_TOKEN }}
|
||||||
|
|
||||||
@@ -45,32 +45,19 @@ jobs:
|
|||||||
echo "=== 文件大小统计 ==="
|
echo "=== 文件大小统计 ==="
|
||||||
du -h ruleset/*
|
du -h ruleset/*
|
||||||
|
|
||||||
- name: 配置 Git
|
- name: 提交规则文件到仓库
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --local user.email "action@github.com"
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --local user.name "GitHub Action"
|
||||||
|
|
||||||
- name: 提交并推送规则文件
|
|
||||||
run: |
|
|
||||||
# 添加所有文件到暂存区
|
|
||||||
git add ruleset/
|
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 }}
|
||||||
|
|
||||||
# 检查是否有更改
|
- name: 上传规则文件 (备用)
|
||||||
if git diff --staged --quiet; then
|
uses: actions/upload-artifact@v4
|
||||||
echo "没有检测到文件更改,跳过提交"
|
with:
|
||||||
else
|
name: clash-rules-${{ github.run_number }}
|
||||||
# 提交更改
|
path: ruleset/
|
||||||
git commit -m "Auto update clash rules - $(date +%Y-%m-%d)"
|
retention-days: 30
|
||||||
|
|
||||||
# 推送到仓库
|
|
||||||
git push origin ${{ github.ref_name }}
|
|
||||||
echo "规则文件已成功推送到仓库"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: 创建发布标签 (可选)
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
run: |
|
|
||||||
TAG_NAME="rules-$(date +%Y%m%d-%H%M%S)"
|
|
||||||
git tag $TAG_NAME
|
|
||||||
git push origin $TAG_NAME
|
|
||||||
echo "已创建标签: $TAG_NAME"
|
|
||||||
Reference in New Issue
Block a user