54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
name: Auto Merge Sites to zy.json
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows:
|
|
- "自动解密_Spider下载_生成新Jar配置"
|
|
- "自动调用API解密并注入Sites生成moyu.json"
|
|
types:
|
|
- completed
|
|
|
|
workflow_dispatch: # 允许你在 GitHub 页面上手动点击运行
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write # 给予工作流向仓库提交代码的权限
|
|
|
|
steps:
|
|
# 1. 拉取仓库代码
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
# 2. 安装 Python 环境
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
# 3. 安装脚本依赖项
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install chardet json5
|
|
|
|
# 4. 运行合并脚本
|
|
- name: Run merge script
|
|
run: python merge_to_zy.py
|
|
|
|
# 5. 将生成的 zy.json 提交回仓库
|
|
- name: Commit and push changes
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
# 检查 zy.json 是否有变化,若有变化则提交
|
|
if [ -n "$(git status --porcelain zy.json)" ]; then
|
|
git add zy.json
|
|
git commit -m "chore: 自动更新 zy.json [skip ci]"
|
|
git push
|
|
else
|
|
echo "zy.json 没有变化,跳过提交。"
|
|
fi
|