14
14
sync :
15
15
name : ' Submodules Sync'
16
16
runs-on : ubuntu-22.04
17
+ if : github.actor != 'github-actions[bot]'
17
18
18
19
defaults :
19
20
run :
@@ -24,16 +25,30 @@ jobs:
24
25
uses : actions/checkout@v5
25
26
with :
26
27
token : ${{ secrets.GITHUB_TOKEN }}
27
- submodules : true
28
+ submodules : recursive
29
+ persist-credentials : false
30
+
31
+ - name : Sync submodule URLs
32
+ run : |
33
+ git submodule sync --recursive
28
34
29
35
- name : Update submodules
30
36
run : |
31
- git submodule update --init --remote --recursive
37
+ git -c protocol.version=2 submodule update --init --remote --recursive --jobs 8
32
38
33
39
- name : Commit and push submodule updates
40
+ env :
41
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34
42
run : |
35
- git config --global user.name 'Git bot'
36
- git config --global user.email '[email protected] '
37
- git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
38
- git add .
39
- git diff --quiet && echo "No changes to commit" || (git commit -m "Auto updated submodule references" && git push)
43
+ set -euo pipefail
44
+ git config user.name 'github-actions[bot]'
45
+ git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
46
+ git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}
47
+ # Stage only submodule pointer updates and .gitmodules
48
+ git add .gitmodules $(git config -f .gitmodules --get-regexp path | awk '{print $2}') || true
49
+ if git diff --cached --quiet; then
50
+ echo "No submodule pointer changes to commit"
51
+ exit 0
52
+ fi
53
+ git commit -m "chore(submodules): auto-update pointers [skip ci]"
54
+ git push
0 commit comments