-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (35 loc) · 1.42 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
name: Update Submodules
on:
workflow_dispatch:
jobs:
update-submodules:
runs-on: ubuntu-latest
steps:
# Checkout the repository including submodules
- name: Checkout repository with submodules
uses: actions/checkout@v3
with:
submodules: recursive
# Set Git committer identity
- name: Set Git committer identity
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Pull the latest changes for each submodule using merge strategy and resolve conflicts automatically
- name: Pull latest changes for submodules (auto resolve conflicts)
run: |
git submodule foreach 'git fetch && git merge -X theirs || true'
# Commit and push changes
- name: Commit and push changes
env:
TOKEN: ${{ secrets.wk_token }} # Use the PAT secret for authentication
run: |
if [ -n "$(git status --porcelain)" ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Update submodules with merged changes"
git push https://[email protected]/WatermelonKatanaDevs/WatermelonKatana.git HEAD
else
echo "No changes in submodules to commit."
fi