fix: run git reset commands as agent user to avoid safe.directory errors (#336)
Some checks failed
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline failed

This commit is contained in:
Agent 2026-04-07 08:25:54 +00:00
parent dc4ed90b56
commit 27f9da57d3

View file

@ -29,10 +29,12 @@ if [ ! -d "${PROJECT_REPO_ROOT}/.git" ]; then
fi
# Reset base repo to origin/main to avoid divergence warnings
cd "$PROJECT_REPO_ROOT"
git fetch origin main
git checkout main 2>/dev/null || true
git reset --hard origin/main
su -s /bin/bash agent -c "
cd '/home/agent/repos/disinto'
git fetch origin main
git checkout main 2>/dev/null || true
git reset --hard origin/main
"
log "Base repo reset to origin/main"
log "Entering poll loop (interval: ${POLL_INTERVAL:-300}s)"