zhizhi/.github/workflows/sync-dev-status.yml

54 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: "📡 铸渊 · dev-status 自动同步"
on:
schedule:
- cron: '0 1 * * *' # UTC 01:00 = 北京时间 09:00
- cron: '0 14 * * *' # UTC 14:00 = 北京时间 22:00
workflow_dispatch: # 支持手动触发
permissions:
contents: write
pull-requests: write
jobs:
sync-dev-status:
name: 同步 dev-status.json
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# ── 执行同步脚本 ──
- name: 同步 dev-status.json
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
DEV_STATUS_DB_ID: ${{ secrets.DEV_STATUS_DB_ID }}
run: node scripts/sync-dev-status.js
# ── 通过 PR 提交更新(兼容 branch protection──
- name: 设置同步时间
run: echo "SYNC_TIME=$(TZ='Asia/Shanghai' date '+%Y-%m-%d %H:%M')" >> $GITHUB_ENV
- name: 提交 dev-status 更新
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "📡 dev-status 同步 · ${{ env.SYNC_TIME }} [skip ci]"
title: "📡 dev-status 自动同步 · ${{ env.SYNC_TIME }}"
body: |
🤖 铸渊自动同步 dev-status.json
- 同步时间: ${{ env.SYNC_TIME }}
- 触发方式: ${{ github.event_name }}
branch: auto/sync-dev-status
delete-branch: true
add-paths: |
.github/persona-brain/dev-status.json
dev-status.json
labels: auto-sync