Skip to content

Commit 4e65032

Browse files
authored
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.
1 parent ad60129 commit 4e65032

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Update Submodules
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
schedule:
8+
- cron: '0 0 * * *'
9+
workflow_dispatch:
10+
11+
jobs:
12+
update-submodules:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out repository
17+
uses: actions/checkout@v3
18+
with:
19+
submodules: recursive
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Update submodules to remote HEAD
23+
run: |
24+
git submodule sync --recursive
25+
git submodule update --init --recursive --remote
26+
27+
- name: Check if there are changes
28+
run: |
29+
if [ -n "$(git status --porcelain)" ]; then
30+
git config user.name "github-actions[bot]"
31+
git config user.email "github-actions[bot]@users.noreply.github.com"
32+
git add .
33+
git commit -m "chore: update submodules to latest"
34+
else
35+
echo "No changes to commit."
36+
fi
37+
38+
- name: Push changes
39+
if: always()
40+
run: |
41+
if [ -n "$(git log -1 --pretty=%B | grep 'chore: update submodules')" ]; then
42+
git push origin HEAD:${{ github.ref_name }}
43+
fi

0 commit comments

Comments
 (0)