Skip to content

Update Submodules

Update Submodules #6

name: Update Submodules
on:
schedule:
- cron: '0 0 */3 * *' # every 3 days at midnight
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: Update submodules
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# update submodules
git submodule update --remote --recursive
# check if there are changes
if git diff --cached --quiet && git diff --quiet; then
echo "No updates found in submodules"
exit 0
fi
# commit and push changes
git add .
git commit -m "update submodules [skip ci]"
git push
- name: Check for errors
if: failure()
run: |
echo "::error::Failed to update submodules. Please check the logs above for details."