File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -162,3 +162,26 @@ jobs:
162162 --body "Updates cookiecutter.template_sha from ${{ steps.old_sha.outputs.sha }} to ${{ steps.new_sha.outputs.sha }}" \
163163 --base '${{ inputs.repo_branch }}' \
164164 --head "$BRANCH"
165+ - name : Final cleanup (remove temp dirs & neutralize bad .gitmodules)
166+ if : always()
167+ shell : bash
168+ run : |
169+ set -euo pipefail
170+
171+ # Remove temporary working folders & patch file
172+ rm -rf base-template template-source template-base template-new update.patch
173+
174+ # Defensive: if a stray/invalid .gitmodules exists (missing URL entries),
175+ # delete it so actions/checkout post-job doesn't crash on submodule foreach.
176+ if [ -f .gitmodules ]; then
177+ if ! git config -f .gitmodules --get-regexp '^submodule\..*\.url$' >/dev/null 2>&1; then
178+ echo "Removing invalid .gitmodules (no submodule URLs found)."
179+ rm -f .gitmodules
180+ # Purge any lingering local submodule config and modules dir
181+ git config --local --name-only --get-regexp '^submodule\.' \
182+ | xargs -r -n1 -I {} git config --local --unset-all "{}"
183+ rm -rf .git/modules || true
184+ fi
185+ fi
186+
187+ echo "Cleanup complete."
You can’t perform that action at this time.
0 commit comments