Skip to content

Daily Submodule Update #230

Daily Submodule Update

Daily Submodule Update #230

name: Daily Submodule Update
on:
schedule:
- cron: "0 */5 * * *" # Run every 5 hours
workflow_dispatch: # Allows manual triggering
jobs:
update-submodules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: "false" # Don't checkout submodules initially
fetch-depth: 0
- name: Initialize public submodules
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
# Initialize and update all submodules except pearai-server
git submodule update --init --recursive -- pear-landing-page pearai-app pearai-documentation pearai-server-issues-public pearai-submodule
- name: Update submodules
run: |
# Selective submodule update
git submodule foreach '
if [ "$path" != "pearai-server" ]; then
git fetch
git checkout origin/main
else
echo "Skipping update for $path"
fi
'
# Check if there are changes
if [[ -n $(git status -s) ]]; then
# Commit and push changes
git add .
git commit -m "Daily update of submodules $(date +%Y-%m-%d)"
git push origin main
else
echo "No updates to submodules."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}