guanghulab/guanghulab-main/.github/workflows/bridge-changes-to-notion.yml
Guanghu Domestic Migration d1e47f4565
Some checks are pending
自动更新代码和重启 / update-and-restart (push) Waiting to run
CI检查 + 自动部署 / check (push) Waiting to run
CI检查 + 自动部署 / deploy (push) Blocked by required conditions
重启聊天服务 / restart (push) Waiting to run
chore: import sanitized domestic snapshot for REPO-002
Source snapshot: ca48d3ddf926d79aa138306164169baf764bb829
2026-07-17 15:54:41 +08:00

73 lines
3.0 KiB
YAML
Raw Permalink 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: 铸渊 · Bridge E · GitHub Changes → Notion
# 管道 Emain 分支有 push 或 PR 创建/关闭 → 变更摘要同步到 Notion「📋 GitHub 变更日志」数据库
#
# 依赖 Secrets仓库 Settings → Secrets and variables → Actions
# NOTION_TOKEN Notion 集成 token
#
# CHANGES_DB_ID 已内置默认值e740b77aa6bd4ac0a2e8a75f678fba98
# 如需覆盖,可在 Secrets 中添加 CHANGES_DB_ID
on:
push:
branches: [main]
pull_request:
types: [opened, closed]
jobs:
bridge-changes-to-notion:
name: 📡 Bridge E · GitHub Changes → Notion
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2 # 获取前一次 commit 以便 diff
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# ── commit push ──────────────────────────────────────
- name: 📡 同步 commit 变更到 Notion
if: github.event_name == 'push'
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
CHANGES_DB_ID: ${{ secrets.CHANGES_DB_ID }}
EVENT_TYPE: commit
COMMIT_SHA: ${{ github.sha }}
COMMIT_MSG: ${{ github.event.head_commit.message }}
COMMITTER: ${{ github.event.head_commit.author.name || github.actor }}
COMMIT_TIMESTAMP: ${{ github.event.head_commit.timestamp }}
BRANCH: ${{ github.ref_name }}
run: |
# git diff 输出换行分隔的变更文件列表(包含新增、修改、删除)
# COMMIT_TIMESTAMP/COMMITTER fallback: GitHub 表达式 || 在空字符串时也会取右侧值
CHANGED=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || true)
export CHANGED_FILES="$CHANGED"
node scripts/notion-bridge.js changes
# ── PR 事件 ───────────────────────────────────────────
- name: 📡 同步 PR 变更到 Notion
if: github.event_name == 'pull_request'
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
CHANGES_DB_ID: ${{ secrets.CHANGES_DB_ID }}
EVENT_TYPE: pr
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_ACTION: ${{ github.event.action }}
PR_MERGED: ${{ github.event.pull_request.merged }}
COMMITTER: ${{ github.event.pull_request.user.login }}
COMMIT_TIMESTAMP: ${{ github.event.pull_request.updated_at }}
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
COMMIT_MSG: ${{ github.event.pull_request.title }}
BRANCH: ${{ github.event.pull_request.head.ref }}
run: node scripts/notion-bridge.js changes