Skip to content

Sync and Compile AppleTV Rules #9

Sync and Compile AppleTV Rules

Sync and Compile AppleTV Rules #9

Workflow file for this run

name: Sync and Compile AppleTV Rules
on:
schedule:
- cron: '0 18 * * *' # 北京时间 02:00 执行
workflow_dispatch:
permissions:
contents: write
jobs:
appletv_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 AppleTV Rules
run: |
mkdir -p rules/Domain # 确保目录存在
# 下载 AppleTV 规则文件
curl -sL "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/refs/heads/master/rule/Clash/AppleTV/AppleTV.list" -o rules/Domain/appletv.list
- name: Convert AppleTV Rules to YAML
run: |
echo "payload:" > rules/Domain/appletv_combined.yaml
while IFS=, read -r type value; do
if [[ -n "$type" && -n "$value" ]]; then
echo " - $type,$value" >> rules/Domain/appletv_combined.yaml
fi
done < rules/Domain/appletv.list
- name: Convert AppleTV Rules to MRS
run: |
mihomo convert-ruleset domain yaml rules/Domain/appletv_combined.yaml rules/Domain/appletv.mrs
rm -f rules/Domain/appletv.list rules/Domain/appletv_combined.yaml
- name: Commit and Push Changes
run: |
git add .
git diff-index --quiet HEAD -- || (git commit -m "Updated AppleTV rules (AppleTV.list -> appletv.mrs)" && git push)