Merge pull request 'fix: fix: review-pr.sh runs git commands before cd-ing to project repo — fails after image rebuild (#408)' (#417) from fix/issue-408 into main
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
This commit is contained in:
commit
fa47653f1d
1 changed files with 5 additions and 2 deletions
|
|
@ -35,6 +35,10 @@ git -C "$FACTORY_ROOT" pull --ff-only origin main 2>/dev/null || true
|
||||||
|
|
||||||
# --- Config ---
|
# --- Config ---
|
||||||
PR_NUMBER="${1:?Usage: review-pr.sh <pr-number> [--force]}"
|
PR_NUMBER="${1:?Usage: review-pr.sh <pr-number> [--force]}"
|
||||||
|
|
||||||
|
# Change to project repo early — required before any git commands
|
||||||
|
# (factory root is not a git repo after image rebuild)
|
||||||
|
cd "${PROJECT_REPO_ROOT}"
|
||||||
FORCE="${2:-}"
|
FORCE="${2:-}"
|
||||||
API="${FORGE_API}"
|
API="${FORGE_API}"
|
||||||
LOGFILE="${DISINTO_LOG_DIR}/review/review.log"
|
LOGFILE="${DISINTO_LOG_DIR}/review/review.log"
|
||||||
|
|
@ -163,12 +167,11 @@ DNOTE=""; [ "$FSIZE" -gt "$MAX_DIFF" ] && DNOTE=" (truncated from ${FSIZE} bytes
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# WORKTREE SETUP
|
# WORKTREE SETUP
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
cd "${PROJECT_REPO_ROOT}"
|
|
||||||
git fetch "${FORGE_REMOTE}" "$PR_HEAD" 2>/dev/null || true
|
git fetch "${FORGE_REMOTE}" "$PR_HEAD" 2>/dev/null || true
|
||||||
|
|
||||||
if [ -d "$WORKTREE" ]; then
|
if [ -d "$WORKTREE" ]; then
|
||||||
cd "$WORKTREE"; git checkout --detach "$PR_SHA" 2>/dev/null || {
|
cd "$WORKTREE"; git checkout --detach "$PR_SHA" 2>/dev/null || {
|
||||||
cd "${PROJECT_REPO_ROOT}"; worktree_cleanup "$WORKTREE"
|
worktree_cleanup "$WORKTREE"
|
||||||
git worktree add "$WORKTREE" "$PR_SHA" --detach 2>/dev/null; }
|
git worktree add "$WORKTREE" "$PR_SHA" --detach 2>/dev/null; }
|
||||||
else
|
else
|
||||||
git worktree add "$WORKTREE" "$PR_SHA" --detach 2>/dev/null
|
git worktree add "$WORKTREE" "$PR_SHA" --detach 2>/dev/null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue