Skip to content

Commit cdcb046

Browse files
committed
fix(ci): clean stale legacy tracked dirs before submodule init
After the monorepo split, the old eafw_* directories remain on disk on the staging server even after git reset --hard (the directories aren't removed because they were tracked content, not files). git submodule update --init then fails with 'destination path already exists and is not an empty directory'. Remove any eafw_* directory that doesn't already contain its own .git reference before running the submodule init. Idempotent — once the cleanup runs once and the submodules are properly checked out, the condition (! -e $sub/.git) is false and the rm is skipped.
1 parent abded75 commit cdcb046

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/deploy-staging.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,17 @@ jobs:
326326
cd $REPO_DIR
327327
fi
328328
329+
# One-time cleanup: legacy tracked directories from before the
330+
# submodule split linger on disk after a git reset --hard, blocking
331+
# the fresh submodule clone. Remove anything that isn't already a
332+
# git checkout itself.
333+
for sub in eafw_geomanager eafw_geomanager_web eafw_geomapviewer eafw_georeport; do
334+
if [ -d "$sub" ] && [ ! -e "$sub/.git" ]; then
335+
rm -rf "$sub"
336+
echo " cleaned stale legacy directory: $sub"
337+
fi
338+
done
339+
329340
# Sync + init/update every submodule to the SHA committed by the parent
330341
git submodule sync --recursive
331342
git submodule update --init --recursive --force

0 commit comments

Comments
 (0)