Update Submodules #7
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: | |
workflow_dispatch: # allow manual trigger | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * *" # daily update | |
jobs: | |
update-submodules: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive # update all submodules | |
- name: Update submodules to latest commit | |
run: | | |
git config --global user.name "GitHub Actions Bot" | |
git config --global user.email "[email protected]" | |
git submodule update --remote --merge | |
if [[ $(git status --porcelain) ]]; then | |
# Check if there are changes | |
echo "Changes detected, committing and pushing..." | |
git add . | |
git commit -m "Update submodules to latest" | |
git push origin main | |
else | |
echo "No changes detected, skipping commit and push." | |
fi |