Skip to content

Commit ba6db31

Browse files
committed
GHA submodule updates.
1 parent 7e27cfe commit ba6db31

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

.github/workflows/docker-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
provenance: false
7474
push: true
7575

76+
7677
- name: Build & push singleuser (amd64)
7778
id: su
7879
uses: docker/build-push-action@v6
@@ -187,7 +188,6 @@ jobs:
187188
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
188189
type=ref,event=branch,enable=${{ github.event_name != 'pull_request' }}
189190
type=sha,format=short
190-
191191
- uses: docker/login-action@v3
192192
with:
193193
username: ${{ secrets.DOCKER_HUB_USERNAME }}

.github/workflows/submodule_sync.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
sync:
1515
name: 'Submodules Sync'
1616
runs-on: ubuntu-22.04
17+
if: github.actor != 'github-actions[bot]'
1718

1819
defaults:
1920
run:
@@ -24,16 +25,30 @@ jobs:
2425
uses: actions/checkout@v5
2526
with:
2627
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
2834
2935
- name: Update submodules
3036
run: |
31-
git submodule update --init --remote --recursive
37+
git -c protocol.version=2 submodule update --init --remote --recursive --jobs 8
3238
3339
- name: Commit and push submodule updates
40+
env:
41+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3442
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

Comments
 (0)