自动更新子模块 #134
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 自动更新子模块 | |
on: | |
schedule: | |
- cron: '0 0 * * *' # 每天UTC时间0:00执行 | |
workflow_dispatch: | |
jobs: | |
update-submodules: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 签出仓库 | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- name: 更新子模块 | |
continue-on-error: true | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git pull | |
git submodule update --init | |
git submodule update --remote | |
git add . | |
if git diff --staged --quiet; then | |
echo "跳过更新:子模块没有变化" | |
else | |
git commit -m "自动更新子模块 [skip ci]" | |
git push | |
fi |