Skip to content

Daily Slack Health Report #61

Daily Slack Health Report

Daily Slack Health Report #61

name: Daily Slack Health Report
on:
schedule:
# 01:00 UTC = 10:00 KST (매일 오전 10시)
- cron: '0 1 * * *'
workflow_dispatch: # 수동 실행 가능
jobs:
sync-and-report:
runs-on: ubuntu-latest
steps:
- name: Force Sync Yesterday's Data
run: |
# KST 기준 어제 날짜 계산 (UTC+9)
YESTERDAY=$(TZ='Asia/Seoul' date -d 'yesterday' '+%Y-%m-%d')
echo "Syncing data for: $YESTERDAY"
response=$(curl -s -w "\n%{http_code}" \
"https://taghere-analytics-8gzo.onrender.com/api/sync/force-date?token=${{ secrets.CACHE_REFRESH_TOKEN }}&date=$YESTERDAY")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
echo "Sync Response: $body"
echo "HTTP Code: $http_code"
if [ "$http_code" -ne 200 ]; then
echo "Warning: Data sync failed, but continuing with report..."
else
echo "Data sync completed successfully!"
fi
- name: Wait for sync to settle
run: sleep 5
- name: Send Daily Health Report to Slack
run: |
echo "Sending Slack report..."
response=$(curl -s -w "\n%{http_code}" \
"https://taghere-analytics-8gzo.onrender.com/api/slack/daily-summary?token=${{ secrets.CACHE_REFRESH_TOKEN }}")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
echo "Report Response: $body"
echo "HTTP Code: $http_code"
if [ "$http_code" -ne 200 ]; then
echo "Failed to send Slack report"
exit 1
fi
echo "Slack report sent successfully!"