Update Submodules #152
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: Update Submodules | |
on: | |
push: | |
branches: [ main ] | |
schedule: | |
- cron: "45 10 * * *" | |
workflow_dispatch: | |
jobs: | |
update_submodules: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
token: ${{ secrets.PAT }} # 使用个人访问令牌 | |
- name: Update submodules | |
run: | | |
git submodule update --remote | |
- name: Commit changes | |
run: | | |
if git diff --exit-code; then | |
echo "No submodule updates detected." | |
else | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update submodules" | |
git push | |
fi |