Skip to content

Daily Summary Report #115

Daily Summary Report

Daily Summary Report #115

Workflow file for this run

name: Daily Summary Report
on:
schedule:
- cron: "58 14 * * *"
permissions:
contents: read
jobs:
daily-graph:
runs-on: ubuntu-latest
concurrency:
group: daily-graph
cancel-in-progress: true
steps:
- name: Checkout (public repo)
uses: actions/checkout@v4
# 1) GitHub App → installation token
- name: Get installation token (read - only)
id: token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: ${{ secrets.APP_INSTALLATION_ID }}
# 2) Fetch latest metrics CSV
- name: Download metrics CSV
env:
TOKEN: ${{ steps.token.outputs.token }}
run: |
MONTH=$(date +%Y-%m)
curl -f -sSL \
-H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.raw" \
-o metrics.csv \
"https://api.github.com/repos/clockcrockwork/backup-ccc-summary/contents/metrics/system_metrics-${MONTH}.csv" \
|| (echo "[WARN] Download failed. Skipping graph." && touch metrics.csv)
# 3) Python グラフ生成
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: pip install pandas matplotlib
- run: python scripts/generate_graph.py metrics.csv graph.png
# 4) Discord 送信
- name: Post PNG to Discord
if: success() && hashFiles('graph.png') != ''
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
if [ -n "$DISCORD_WEBHOOK_URL" ]; then
curl -F "[email protected]" "$DISCORD_WEBHOOK_URL"
else
echo "DISCORD_WEBHOOK_URL is not set or empty. Skipping Discord notification."
exit 0
fi