Clear stale git lock files before production checkout fetch.
Deploy edu.mstaut.ir / deploy (push) Has been cancelled

Interrupted shallow fetches leave shallow.lock and block the next deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
smhk1376andCursor committed 2026-10-16 16:33:28 +03:30
1 parent 8eee3242bf
commit 69bdaf0113
1 file changed
+7
+7
View File
@@ -27,6 +27,13 @@ jobs:
git -C "$TARGET" init git -C "$TARGET" init
git -C "$TARGET" remote add origin "http://127.0.0.1:8301/$REPO_NAME.git" git -C "$TARGET" remote add origin "http://127.0.0.1:8301/$REPO_NAME.git"
fi fi
# Clear stale locks from interrupted shallow fetches (common after crash/timeout).
# This checkout is deploy-only; concurrency group already serializes jobs.
rm -f \
"$TARGET/.git/shallow.lock" \
"$TARGET/.git/index.lock" \
"$TARGET/.git/HEAD.lock" \
"$TARGET/.git/config.lock"
# Supply the job token only for fetch; never store it in .git/config. # Supply the job token only for fetch; never store it in .git/config.
AUTH=$(printf '%s:%s' "$REPO_ACTOR" "$REPO_TOKEN" | base64 -w0) AUTH=$(printf '%s:%s' "$REPO_ACTOR" "$REPO_TOKEN" | base64 -w0)
git -C "$TARGET" -c "http.extraHeader=Authorization: Basic $AUTH" fetch --depth=1 origin "$DEPLOY_SHA" git -C "$TARGET" -c "http.extraHeader=Authorization: Basic $AUTH" fetch --depth=1 origin "$DEPLOY_SHA"