3b182a0798
Use git -c safe.directory instead of git config --global in the container; set HOME=/tmp for deploy-hook. Co-authored-by: Cursor <cursoragent@cursor.com>
27 lines
605 B
Bash
Executable File
27 lines
605 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
REPO_DIR="/repo"
|
|
BRANCH="${DEPLOY_BRANCH:-main}"
|
|
|
|
if [ ! -d "${REPO_DIR}/.git" ]; then
|
|
echo "Error: ${REPO_DIR} is not a git repository"
|
|
exit 1
|
|
fi
|
|
|
|
cd "${REPO_DIR}"
|
|
|
|
# Container has no writable $HOME — avoid git config --global (//.gitconfig)
|
|
git_cmd() {
|
|
git -c "safe.directory=${REPO_DIR}" "$@"
|
|
}
|
|
|
|
if [ -n "${DEPLOY_GIT_TOKEN:-}" ]; then
|
|
auth_url="https://oauth2:${DEPLOY_GIT_TOKEN}@gitea.schwenk.online/froxxxy/playground.git"
|
|
git_cmd pull "${auth_url}" "${BRANCH}"
|
|
else
|
|
git_cmd pull origin "${BRANCH}"
|
|
fi
|
|
|
|
echo "Deploy pull completed for ${BRANCH}"
|