Thanks to visit codestin.com
Credit goes to github.com

Skip to content

自动更新 all.yaml 文件 #2495

自动更新 all.yaml 文件

自动更新 all.yaml 文件 #2495

Workflow file for this run

name: 自动更新 all.yaml 文件
on:
schedule:
- cron: '0 */2 * * *' # 每两小时执行一次
workflow_dispatch: # 允许手动触发
jobs:
update-yaml:
runs-on: ubuntu-latest
steps:
- name: 检查仓库
uses: actions/checkout@v4
- name: 下载最新文件
run: |
mkdir -p data
curl -L -o data/all.yaml https://gist.githubusercontent.com/dalazhi/d0db537c55d15ba97c80d169bd00bbb7/raw/all.yaml
curl -L -o data/base64.txt https://gist.githubusercontent.com/dalazhi/d0db537c55d15ba97c80d169bd00bbb7/raw/base64.txt
curl -L -o data/mihomo.yaml https://gist.githubusercontent.com/dalazhi/d0db537c55d15ba97c80d169bd00bbb7/raw/mihomo.yaml
curl -L -o data/all-1.yaml https://gist.githubusercontent.com/dalazhi/adf2e62a5931358889eca20256cd0833/raw/all.yaml
curl -L -o data/base64-1.txt https://gist.githubusercontent.com/dalazhi/adf2e62a5931358889eca20256cd0833/raw/base64.txt
curl -L -o data/mihomo-1.yaml https://gist.githubusercontent.com/dalazhi/adf2e62a5931358889eca20256cd0833/raw/mihomo.yaml
curl -L -o data/all-59.yaml https://gist.githubusercontent.com/dalazhi/00911343ab05017bdb181c377b3776f4/raw/all.yaml
curl -L -o data/base64-59.txt https://gist.githubusercontent.com/dalazhi/00911343ab05017bdb181c377b3776f4/raw/base64.txt
curl -L -o data/mihomo-59.yaml https://gist.githubusercontent.com/dalazhi/00911343ab05017bdb181c377b3776f4/raw/mihomo.yaml
curl -L -o data/all-12.yaml https://gist.githubusercontent.com/dalazhi/6be48247c7cb84dd9c3a37fd4e5a81a0/raw/all.yaml
curl -L -o data/base64-12.txt https://gist.githubusercontent.com/dalazhi/6be48247c7cb84dd9c3a37fd4e5a81a0/raw/base64.txt
curl -L -o data/mihomo-12.yaml https://gist.githubusercontent.com/dalazhi/6be48247c7cb84dd9c3a37fd4e5a81a0/raw/mihomo.yam
echo "下载完成"
- name: 检查文件是否有更新
id: check_diff
run: |
if [[ `git status --porcelain` ]]; then
echo "文件有更新"
echo "has_changes=true" >> $GITHUB_ENV
else
echo "文件无更新"
echo "has_changes=false" >> $GITHUB_ENV
fi
- name: 提交更新
if: env.has_changes == 'true'
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git add data/
git commit -m "自动更新配置文件"
git push
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}