-
Notifications
You must be signed in to change notification settings - Fork 8
47 lines (37 loc) · 1.44 KB
/
ai.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Sync and Compile AI Rules
on:
schedule:
- cron: '0 18 * * *' # 北京时间 02:00 执行
workflow_dispatch:
permissions:
contents: write
jobs:
ai_rules:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Install mihomo
run: |
version=$(curl -sL https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/version.txt)
curl -sL "https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/mihomo-linux-amd64-${version}.gz" | \
gunzip -c > /usr/local/bin/mihomo && chmod +x /usr/local/bin/mihomo
- name: Fetch AI Rules
run: |
mkdir -p rules/Domain # 确保目录存在
# 下载 AI 规则文件
curl -sL "https://raw.githubusercontent.com/Lanlan13-14/Rules/refs/heads/main/rules/Domain/ai.yaml" -o rules/Domain/ai.yaml
- name: Convert AI Rules to MRS
run: |
# 使用 mihomo 转换为 MRS 格式
mihomo convert-ruleset domain yaml rules/Domain/ai.yaml rules/Domain/ai.mrs
- name: Commit and Push Changes
run: |
git add .
git diff-index --quiet HEAD -- || (git commit -m "Updated AI rules (ai.yaml -> ai.mrs)" && git push)