Skip to content

Generate List Config #121

Generate List Config

Generate List Config #121

name: Generate List Config
on:
push:
branches:
- master # 当推送到主分支时触发
schedule:
- cron: "0 0 * * *" # 每天定时触发任务
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Download and Extract Rule Files
run: |
# 下载整个仓库的 .tar.gz 文件
#curl -L https://github.com/FQrabbit/SSTap-Rule/archive/refs/heads/main.tar.gz -o sstap-rule.tar.gz
curl -L https://api.github.com/repos/FQrabbit/SSTap-Rule/tarball -o sstap-rule.tar.gz #| tar xz --strip=1 --wildcards '*/rules/*.rule' -C rules
# 解压缩 .tar.gz 文件得到 .tar
mkdir -p sstap-rules
tar -xzvf sstap-rule.tar.gz -C sstap-rules --strip-components=1
# 查看解压后的文件结构,确认 .rule 文件路径
echo "Extracted directory structure:"
find sstap-rules -type d -print
# 查找 .rule 文件并打印文件路径
echo "Located .rule files:"
find sstap-rules/rules -name "*.rule"
# 查找并确认 .rule 文件
#find sstap-rules/FQrabbit-SSTap-Rule-07cbe8f/rules -name "*.rule"
- name: Check Rule Files
run: |
ls -R /home/runner/work/SSTap-Rule/SSTap-Rule/rules
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
- name: Parse and Convert Rules to List Format
run: |
python generate_clash_config.py
- name: Commit and Push List Config
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add *.list
git commit -m "Auto-update list config" || echo "No changes to commit"
git push