From bf092f78732f179f3577121135b7366a2f5d4a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Thu, 7 May 2026 03:04:44 +0900 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=B5=D0=BD=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20git=20pull=20=D0=BD=D0=B0=20=D0=B6=D1=91=D1=81=D1=82?= =?UTF-8?q?=D0=BA=D1=83=D1=8E=20=D1=81=D0=B8=D0=BD=D1=85=D1=80=D0=BE=D0=BD?= =?UTF-8?q?=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8E=20=D0=BE=D0=B1=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/apply_github_update.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/apply_github_update.sh b/scripts/apply_github_update.sh index 9a8e582..1fe1315 100644 --- a/scripts/apply_github_update.sh +++ b/scripts/apply_github_update.sh @@ -63,8 +63,24 @@ log "before version: $BEFORE_VERSION" write_state "running" "Получаем изменения из GitHub" run_step git fetch "$REMOTE" "$BRANCH" -write_state "running" "Применяем git pull" -run_step git pull --ff-only "$REMOTE" "$BRANCH" +TARGET_REF="${REMOTE}/${BRANCH}" +TARGET_COMMIT="$(git rev-parse "$TARGET_REF" 2>/dev/null || true)" +if [ -z "$TARGET_COMMIT" ]; then + log "ERROR: remote ref not found: $TARGET_REF" + write_state "error" "Не найден удалённый ref: $TARGET_REF" + exit 1 +fi + +LOCAL_STATUS="$(git status --porcelain 2>/dev/null || true)" +if [ -n "$LOCAL_STATUS" ]; then + log "Local changes before update:" + printf '%s\n' "$LOCAL_STATUS" >> "$LOG_FILE" +fi + +write_state "running" "Синхронизируем исходники с GitHub" +log "Deploy mode: git reset --hard $TARGET_REF" +run_step git reset --hard "$TARGET_REF" +run_step git clean -fd AFTER_COMMIT="$(git rev-parse HEAD 2>/dev/null || true)" AFTER_VERSION="$(cat VERSION 2>/dev/null || echo unknown)"