feat: weekly_digest.py - 周度日报合成分析 (读取7份日报→AI合成周报)
This commit is contained in:
31
scripts/run_weekly_digest.sh
Executable file
31
scripts/run_weekly_digest.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Weekly digest cron wrapper
|
||||
# Run every Sunday at 08:00 UTC (16:00 Beijing)
|
||||
# Synthesizes 7 daily digests into a week-level analysis report
|
||||
#
|
||||
# Scheduled earlier than the daily digest (22:00) to ensure
|
||||
# the most recent daily digest has already been generated.
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_DIR="$HOME/inspiration-collector"
|
||||
LOG_FILE="$PROJECT_DIR/ai-insights/logs/weekly_digest.log"
|
||||
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting weekly digest synthesis..." >> "$LOG_FILE"
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
/usr/bin/python3 analyzers/weekly_digest.py >> "$LOG_FILE" 2>&1
|
||||
|
||||
# Git push handled inside weekly_digest.py (git_push_weekly)
|
||||
# Duplicate push here as safety net in case the script's push failed
|
||||
cd "$PROJECT_DIR"
|
||||
if [[ -n $(git status --porcelain ai-insights/) ]]; then
|
||||
git add ai-insights/
|
||||
git commit -m "weekly digest W$(date '+%V') - safety push"
|
||||
git push origin main 2>&1 | tail -3 >> "$LOG_FILE"
|
||||
echo "Safety push done" >> "$LOG_FILE"
|
||||
fi
|
||||
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Weekly digest done." >> "$LOG_FILE"
|
||||
Reference in New Issue
Block a user