name: 📦 Grid-DB 月度归档

on:
  schedule:
    - cron: '0 2 1 * *'
  workflow_dispatch:

permissions:
  contents: write

jobs:
  archive:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: 📦 归档上月交互数据
        run: node scripts/grid-db/monthly-archive.js

      - name: 💾 提交
        run: |
          git config user.name "zhuyuan-bot"
          git config user.email "zhuyuan@guanghulab.com"
          git add grid-db/
          git diff --cached --quiet || git commit -m "archive: 月度交互数据归档 [skip ci]"
          git push
