-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
2 additions
and
47 deletions.
There are no files selected for viewing
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
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 | ||
|
@@ -78,4 +33,4 @@ jobs: | |
git push | ||
else | ||
echo "No changes in submodules." | ||
fi | ||
fi |