From eecd0799a095ef41714840c6fd6ee1b6d38bdb4a Mon Sep 17 00:00:00 2001 From: Michael Chus Date: Thu, 5 Mar 2026 22:44:22 +0300 Subject: [PATCH] fix: check local/remote sync before building to prevent building stale code Co-Authored-By: Claude Sonnet 4.6 --- scripts/run-builder.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/run-builder.sh b/scripts/run-builder.sh index 687b9b6..5cef707 100755 --- a/scripts/run-builder.sh +++ b/scripts/run-builder.sh @@ -35,6 +35,24 @@ echo "=== bee builder ===" echo "Builder: ${BUILDER_HOST}" echo "" +# --- check local repo is in sync with remote --- +cd "${REPO_ROOT}" +git fetch --quiet origin main +LOCAL=$(git rev-parse HEAD) +REMOTE=$(git rev-parse origin/main) +if [ "$LOCAL" != "$REMOTE" ]; then + echo "ERROR: local repo is not in sync with remote." + echo " local: $LOCAL" + echo " remote: $REMOTE" + echo "" + echo "Push or pull before building:" + echo " git push — if you have unpushed commits" + echo " git pull — if remote is ahead" + exit 1 +fi +echo "repo: in sync with remote ($LOCAL)" +echo "" + ssh -o StrictHostKeyChecking=no root@"${BUILDER_HOST}" /bin/sh <