Skip to content

Commit

Permalink
Update update-submodules.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
czyt authored Apr 17, 2024
1 parent ec1bfcb commit a8b6cb7
Showing 1 changed file with 2 additions and 47 deletions.
49 changes: 2 additions & 47 deletions .github/workflows/update-submodules.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,18 @@
name: Update Submodules


on:
schedule:
# 每6小时执行一次
- cron: '0 */6 * * *'
push:
# 当main分支有新的推送时执行
branches:
- main




jobs:
update:
runs-on: ubuntu-latest


steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
# 确保拉取所有子模块
submodules: 'recursive'

- name: Update Submodules
run: |
git submodule update --remote --recursive
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# 仅当子模块发生变化时继续操作
SUBMODULES_CHANGED=$(git status --porcelain=v1 2>/dev/null | grep "^ M")
if [ "x$SUBMODULES_CHANGED" != "x" ]; then
git commit -am "Automatically update submodules"
git push
else
echo "No changes in submodules."
name: Update Submodules


on:
schedule:
# 每6小时执行一次
# 每3小时执行一次
- cron: '0 */6 * * *'
push:
# 当main分支有新的推送时执行
branches:
- main




jobs:
update:
runs-on: ubuntu-latest


steps:
- name: Checkout the repository
uses: actions/checkout@v2
Expand All @@ -78,4 +33,4 @@ jobs:
git push
else
echo "No changes in submodules."
fi
fi

0 comments on commit a8b6cb7

Please sign in to comment.