From eaebcad4750c34f84e2ef7c1c6635b85b768a56b Mon Sep 17 00:00:00 2001 From: Lectom C Han Date: Mon, 22 Dec 2025 18:17:13 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EB=B8=8C=EB=9F=B0?= =?UTF-8?q?=EC=B9=98=20=EC=84=A0=EC=96=B8=20=EC=9C=84=EC=B9=98=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EB=93=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/backup.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/backup.yml b/.gitea/workflows/backup.yml index eb9cab4..b8e2c68 100644 --- a/.gitea/workflows/backup.yml +++ b/.gitea/workflows/backup.yml @@ -400,14 +400,19 @@ jobs: notify_status "start" "${repo_name}" "${branch_name}" "${backup_mode}" "${start_epoch}" "" "${heads_detail}" exec_start_epoch=$(date +%s) + SOURCE_FETCH_REMOTE="${SOURCE_SSH_HOST}:${source_repo}" shallow_exclude_args=() if ${repo_exists} && [[ -n "${target_commit:-}" ]] && [[ "${USE_SHALLOW_EXCLUDE}" != "false" ]]; then - shallow_exclude_args=(--shallow-exclude="${target_commit}") + commit_on_source=$(git ls-remote "${SOURCE_FETCH_REMOTE}" "${target_commit}" || true) + if [[ -n "${commit_on_source}" ]]; then + shallow_exclude_args=(--shallow-exclude="${target_commit}") + else + echo "::notice::Target commit ${target_commit} not found on source; skipping shallow-exclude." + fi fi CLONE_DIR=$(mktemp -d) echo "Working directory: ${CLONE_DIR}" - SOURCE_FETCH_REMOTE="${SOURCE_SSH_HOST}:${source_repo}" if ${just_created}; then echo "Target repo newly created; cloning source branch for initial push..." if ! git clone --bare --no-tags --single-branch --branch "${branch_name}" "${SOURCE_FETCH_REMOTE}" "${CLONE_DIR}"; then @@ -546,13 +551,25 @@ jobs: fi - name: Build markdown report - if: always() && hashFiles('backup_reports/report_*.md') != '' + if: always() run: | set -euo pipefail REPORT_DIR="${REPORT_DIR:-${GITHUB_WORKSPACE}/backup_reports}" TS="${REPORT_TS:-}" if [[ -z "${TS}" ]]; then - TS=$(ls -t ${REPORT_DIR}/decisions_*.log 2>/dev/null | head -1 | sed -E 's/.*decisions_([0-9_]+)\.log/\1/') + shopt -s nullglob + decision_files=(${REPORT_DIR}/decisions_*.log) + if (( ${#decision_files[@]} == 0 )); then + echo "No decision logs found in ${REPORT_DIR}; skipping report generation." + exit 0 + fi + IFS=$'\n' decision_files_sorted=($(ls -1t "${decision_files[@]}")) + shopt -u nullglob + TS=$(basename "${decision_files_sorted[0]}" | sed -E 's/decisions_([0-9_]+)\.log/\1/') + fi + if [[ -z "${TS}" ]]; then + echo "Unable to determine report timestamp; skipping report generation." + exit 0 fi DECISIONS_LOG="${REPORT_DIR}/decisions_${TS}.log" TIMINGS_LOG="${REPORT_DIR}/timings_${TS}.log"