리포트 생성 로직 업데이트
This commit is contained in:
@@ -66,6 +66,7 @@ jobs:
|
||||
TOTAL_SUCCESS=0
|
||||
TOTAL_SKIP=0
|
||||
TOTAL_ERROR=0
|
||||
declare -a ERROR_BRANCHES=()
|
||||
TS_KST=$(TZ=Asia/Seoul date '+%Y%m%d_%H%M%S')
|
||||
REPORT_DIR="${ROOT_DIR}/backup_reports"
|
||||
mkdir -p "${REPORT_DIR}"
|
||||
@@ -78,13 +79,28 @@ jobs:
|
||||
: > "${DECISIONS_LOG}"
|
||||
: > "${TIMINGS_LOG}"
|
||||
|
||||
record_error_branch() {
|
||||
local repo="$1" branch="$2" reason="$3"
|
||||
local label="${branch}"
|
||||
if [[ -n "${repo}" ]]; then
|
||||
label="${branch} (${repo})"
|
||||
fi
|
||||
if [[ -n "${reason}" ]]; then
|
||||
label="${label}: ${reason}"
|
||||
fi
|
||||
ERROR_BRANCHES+=("${label}")
|
||||
}
|
||||
|
||||
notify_status() {
|
||||
local status="$1" repo="$2" branch="$3" mode="$4" start_epoch="$5" reason="${6:-}" details="${7:-}"
|
||||
local ts end_epoch duration text payload
|
||||
case "${status}" in
|
||||
success) ((++TOTAL_SUCCESS)) ;;
|
||||
skip) ((++TOTAL_SKIP)) ;;
|
||||
error) ((++TOTAL_ERROR)) ;;
|
||||
error)
|
||||
((++TOTAL_ERROR))
|
||||
record_error_branch "${repo}" "${branch}" "${reason}"
|
||||
;;
|
||||
esac
|
||||
[[ -z "${NOTIFY_WEBHOOK}" ]] && return
|
||||
ts=$(TZ=Asia/Seoul date '+%Y-%m-%d %H:%M:%S %Z')
|
||||
@@ -532,8 +548,15 @@ jobs:
|
||||
done
|
||||
|
||||
TOTAL_PROCESSED=$((TOTAL_SUCCESS + TOTAL_SKIP + TOTAL_ERROR))
|
||||
ERROR_LIST_TEXT=""
|
||||
if (( TOTAL_ERROR > 0 )); then
|
||||
ERROR_LIST_TEXT=$(printf '%s\n' "${ERROR_BRANCHES[@]}" | sort -u | paste -sd',' - | sed 's/,/, /g')
|
||||
fi
|
||||
SUMMARY_TS=$(TZ=Asia/Seoul date '+%Y-%m-%d %H:%M:%S %Z')
|
||||
SUMMARY_TEXT="브랜치 동기화 완료: 총 ${TOTAL_PROCESSED}개 (성공 ${TOTAL_SUCCESS}, 동일로 건너뜀 ${TOTAL_SKIP}, 오류 ${TOTAL_ERROR}) - ${SUMMARY_TS}"
|
||||
if (( TOTAL_ERROR > 0 )) && [[ -n "${ERROR_LIST_TEXT}" ]]; then
|
||||
SUMMARY_TEXT="${SUMMARY_TEXT} | 오류 브랜치: ${ERROR_LIST_TEXT}"
|
||||
fi
|
||||
echo "${SUMMARY_TEXT}"
|
||||
echo "보고서(마크다운)는 이후 스텝에서 생성됩니다."
|
||||
echo "${TOTAL_ERROR}" > "${REPORT_DIR}/exit_code"
|
||||
@@ -546,14 +569,18 @@ jobs:
|
||||
fi
|
||||
|
||||
if (( TOTAL_ERROR > 0 )); then
|
||||
echo "::warning::One or more branches failed (${TOTAL_ERROR}). Proceeding to report generation..."
|
||||
ERROR_LIST_NOTICE="${ERROR_LIST_TEXT:-미기록}"
|
||||
echo "::warning::Branches failed (${TOTAL_ERROR}): ${ERROR_LIST_NOTICE}. Proceeding to report generation..."
|
||||
echo "::notice::오류 브랜치 목록: ${ERROR_LIST_NOTICE}"
|
||||
fi
|
||||
|
||||
- name: Build markdown report
|
||||
if: always()
|
||||
run: |
|
||||
set -euo pipefail
|
||||
REPORT_DIR="${REPORT_DIR:-${GITHUB_WORKSPACE}/backup_reports}"
|
||||
DEFAULT_WORKSPACE="${GITHUB_WORKSPACE:-$(pwd)}"
|
||||
REPORT_DIR="${REPORT_DIR:-${DEFAULT_WORKSPACE}/backup_reports}"
|
||||
mkdir -p "${REPORT_DIR}"
|
||||
TS="${REPORT_TS:-}"
|
||||
if [[ -z "${TS}" ]]; then
|
||||
shopt -s nullglob
|
||||
|
||||
Reference in New Issue
Block a user