From 2804d9002032ca56c341af3a42fc10978dac44cf Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Tue, 22 Jul 2025 10:59:16 +0800 Subject: [PATCH] fix: use safe submodule init in workflows in v3.8.3-patch. (#3469) --- .../update-version-file-on-release.yml | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-version-file-on-release.yml b/.github/workflows/update-version-file-on-release.yml index 45ee143f2..b7e2a4409 100644 --- a/.github/workflows/update-version-file-on-release.yml +++ b/.github/workflows/update-version-file-on-release.yml @@ -15,7 +15,27 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - submodules: "recursive" + # submodules: "recursive" + + - name: Safe submodule initialization + run: | + echo "Checking for submodules..." + if [ -f .gitmodules ]; then + if [ -s .gitmodules ]; then + echo "Initializing submodules..." + if git submodule sync --recursive 2>/dev/null; then + git submodule update --init --force --recursive || { + echo "Warning: Some submodules failed to initialize, continuing anyway..." + } + else + echo "Warning: Submodule sync failed, continuing without submodules..." + fi + else + echo ".gitmodules exists but is empty, skipping submodule initialization" + fi + else + echo "No .gitmodules file found, no submodules to initialize" + fi # Step 2: Set up Git with official account - name: Set up Git