-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added scheduled update of submodules (#37)
When pushing to the master branch, and also once a day, Github Actions runs and updates the commit versions for the submodules.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Update Submodules | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: '0 0 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-submodules: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update submodules to remote HEAD | ||
run: | | ||
git submodule sync --recursive | ||
git submodule update --init --recursive --remote | ||
- name: Check if there are changes | ||
run: | | ||
if [ -n "$(git status --porcelain)" ]; then | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git add . | ||
git commit -m "chore: update submodules to latest" | ||
else | ||
echo "No changes to commit." | ||
fi | ||
- name: Push changes | ||
if: always() | ||
run: | | ||
if [ -n "$(git log -1 --pretty=%B | grep 'chore: update submodules')" ]; then | ||
git push origin HEAD:${{ github.ref_name }} | ||
fi |