-
Notifications
You must be signed in to change notification settings - Fork 20
47 lines (41 loc) · 1.44 KB
/
update-submodules.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 }}