init: inspiration collector v1.0
This commit is contained in:
30
scripts/run_daily_digest.sh
Executable file
30
scripts/run_daily_digest.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# Daily digest cron wrapper
|
||||
# Run daily at 14:00 UTC (22:00 Beijing)
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_DIR="$HOME/inspiration-collector"
|
||||
LOG_FILE="$PROJECT_DIR/ai-insights/logs/daily_digest.log"
|
||||
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting daily digest..." >> "$LOG_FILE"
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
python3 analyzers/daily_digest.py >> "$LOG_FILE" 2>&1
|
||||
|
||||
# Git push to Gitea
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
# Check if there are changes
|
||||
if [[ -n $(git status --porcelain ai-insights/) ]]; then
|
||||
git add ai-insights/
|
||||
git commit -m "daily digest $(date '+%Y-%m-%d')"
|
||||
git push origin main 2>&1 | tail -3 >> "$LOG_FILE"
|
||||
echo "Pushed to Gitea" >> "$LOG_FILE"
|
||||
else
|
||||
echo "No changes to push" >> "$LOG_FILE"
|
||||
fi
|
||||
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Daily digest done." >> "$LOG_FILE"
|
||||
28
scripts/run_weekly_trend.sh
Executable file
28
scripts/run_weekly_trend.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Weekly trend cron wrapper
|
||||
# Run every Sunday at 08:00 UTC (16:00 Beijing)
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_DIR="$HOME/inspiration-collector"
|
||||
LOG_FILE="$PROJECT_DIR/ai-insights/logs/weekly_trend.log"
|
||||
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting weekly trend..." >> "$LOG_FILE"
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
python3 analyzers/weekly_trend.py >> "$LOG_FILE" 2>&1
|
||||
|
||||
# Git push to Gitea
|
||||
cd "$PROJECT_DIR"
|
||||
if [[ -n $(git status --porcelain ai-insights/) ]]; then
|
||||
git add ai-insights/
|
||||
git commit -m "weekly trend W$(date '+%V')"
|
||||
git push origin main 2>&1 | tail -3 >> "$LOG_FILE"
|
||||
echo "Pushed to Gitea" >> "$LOG_FILE"
|
||||
else
|
||||
echo "No changes to push" >> "$LOG_FILE"
|
||||
fi
|
||||
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Weekly trend done." >> "$LOG_FILE"
|
||||
Reference in New Issue
Block a user