shuangyan-notebook/第五域 · Fifth Domain/⚒️ 铸渊·协作指令|GitHub ↔ Notion 桥接协议/🧪 铸渊指令:Notion API 连通性测试(霜砚签发·2026-03-07) 26c1081ba64d40bc892ac89e50bee761.md
Guanghu Domestic Migration a27e87cb99 chore: import sanitized domestic snapshot for REPO-007
Source snapshot: 97d7f0fae96dc04b7ddad56fc1db6a108ed662cc

[SEC-CLEAN] · pre-push-clean v1.0 · 109处敏感信息已自动转乱码
2026-07-17 15:59:55 +08:00

242 lines
7.5 KiB
Markdown
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.

---
belongs_to:
- "[[INDEX · 铸渊·协作指令GitHub ↔ Notion 桥接协议]]"
---
# 🧪 铸渊指令Notion API 连通性测试霜砚签发·2026-03-07
<aside>
🧪
**铸渊执行指令** · 霜砚签发 · 2026-03-07 20:50+08:00
**优先级**P0 · 立即执行
**目标**:验证 GitHub Secrets 中的 NOTION_TOKEN 是否能成功写入 Notion 数据库,确认数据桥全链路打通
</aside>
---
## 🎯 背景
妈妈已将 Notion API Token 配置到 GitHub Secrets`NOTION_TOKEN`)。
现在需要铸渊跑一次真实写入测试,往 Notion 的三个数据库各写一条测试记录,确认双向桥是通的。
---
## 📋 铸渊执行清单(读到就做·不等人)
```jsx
铸渊连通性测试指令 · YM-TEST-20260307-001
来源霜砚Notion执行体)→ 铸渊GitHub执行体
时间2026-03-07
状态待铸渊执行
━━━ 前置确认环境变量 ━━━
确认 GitHub Secrets 中存在以下变量
· NOTION_TOKENNotion Internal Integration Token
确认以下 Database ID已硬编码铸渊直接用
· 信号日志 DB从工单簿页面的 parent database 获取
Database ID见下方每个测试的具体 ID
━━━ 测试一写入跨平台信号日志」━━━
目标数据库名称:📡 跨平台信号日志Signal Log
Notion Database ID将下方 curl 中的 {SIGNAL_LOG_DB_ID} 替换为实际 ID
请在 GitHub Actions 或本地终端执行以下命令
curl -X POST 'https://api.notion.com/v1/pages' \
-H 'Authorization: Bearer '"$NOTION_TOKEN" \
-H 'Content-Type: application/json' \
-H 'Notion-Version: 2022-06-28' \
-d '{
"parent": { "database_id": "{SIGNAL_LOG_DB_ID}" },
"properties": {
"信号编号": {
"title": [{ "text": { "content": "SIG-TEST-20260307-001" } }]
},
"信号类型": {
"select": { "name": "GL-ACK" }
},
"发送方": {
"select": { "name": "铸渊" }
},
"接收方": {
"select": { "name": "霜砚" }
},
"方向": {
"select": { "name": "GitHub→Notion" }
},
"关联DEV": {
"select": { "name": "系统" }
},
"关联模块": {
"select": { "name": "全局" }
},
"执行结果": {
"status": { "name": "成功" }
},
"摘要": {
"rich_text": [{ "text": { "content": "🧪 铸渊→Notion API 连通性测试 · NOTION_TOKEN 验证 · 数据桥首次握手" } }]
},
"备注": {
"rich_text": [{ "text": { "content": "这是一条自动化测试信号。如果你在 Notion 信号日志里看到这条记录,说明 GitHub→Notion 数据桥已打通。" } }]
}
}
}'
期望结果HTTP 200 + 返回新建页面 JSON
验证方式霜砚在 Notion 端查询信号日志数据库能看到这条记录
━━━ 测试二写入GitHub 变更日志」━━━
Notion Database ID {CHANGE_LOG_DB_ID} 替换为实际 ID
curl -X POST 'https://api.notion.com/v1/pages' \
-H 'Authorization: Bearer '"$NOTION_TOKEN" \
-H 'Content-Type: application/json' \
-H 'Notion-Version: 2022-06-28' \
-d '{
"parent": { "database_id": "{CHANGE_LOG_DB_ID}" },
"properties": {
"标题": {
"title": [{ "text": { "content": "🧪 连通性测试 · 铸渊首次握手 · 2026-03-07" } }]
},
"变更类型": {
"select": { "name": "Commit" }
},
"提交者": {
"select": { "name": "铸渊" }
},
"分支": {
"rich_text": [{ "text": { "content": "main" } }]
},
"commit_sha": {
"rich_text": [{ "text": { "content": "test-00000000" } }]
},
"变更文件": {
"rich_text": [{ "text": { "content": ".github/test/bridge-connectivity-test.md" } }]
},
"霜砚已读": {
"checkbox": false
}
}
}'
━━━ 测试三写入GitHub SYSLOG 收件箱」━━━
Notion Database ID {SYSLOG_INBOX_DB_ID} 替换为实际 ID
curl -X POST 'https://api.notion.com/v1/pages' \
-H 'Authorization: Bearer '"$NOTION_TOKEN" \
-H 'Content-Type: application/json' \
-H 'Notion-Version: 2022-06-28' \
-d '{
"parent": { "database_id": "{SYSLOG_INBOX_DB_ID}" },
"properties": {
"标题": {
"title": [{ "text": { "content": "🧪 SYSLOG连通性测试 · 2026-03-07" } }]
},
"DEV编号": {
"select": { "name": "DEV-001" }
},
"处理状态": {
"status": { "name": "待处理" }
},
"推送方": {
"rich_text": [{ "text": { "content": "铸渊" } }]
},
"来源路径": {
"rich_text": [{ "text": { "content": "syslog-inbox/test/bridge-test-20260307.md" } }]
},
"文件内容": {
"rich_text": [{ "text": { "content": "这是一条连通性测试SYSLOG。如果霜砚能在收件箱看到这条说明铸渊→Notion SYSLOG推送管线已打通。" } }]
},
"commit_sha": {
"rich_text": [{ "text": { "content": "test-00000000" } }]
}
}
}'
━━━ 验收标准 ━━━
三条 curl 全部返回 HTTP 200 = 数据桥全通
任何一条返回 401/403 = Token 权限不够检查 Integration 授权范围
任何一条返回 404 = Database ID 错误核对 ID
任何一条返回 400 = 字段名/格式不对看返回的 error message
━━━ 执行确认 ━━━
铸渊完成后回复以下格式
YM-TEST-20260307-001 连通性测试完成
· 信号日志写入:✅/❌( page_id error
· 变更日志写入:✅/❌( page_id error
· SYSLOG收件箱写入:✅/❌( page_id error
· 总结数据桥状态 = 全通 / 部分通 / 不通
```
---
## ⚠️ Database ID 获取方式
<aside>
💡
**铸渊如何拿到 Database ID**
每个 Notion 数据库的 URL 格式为:
`https://www.notion.so/xxxxx?v=yyyyy`
其中 `xxxxx` 就是 Database ID32位十六进制中间无横线
三个数据库的 Notion 链接(铸渊从这里提取 ID
- 📡 信号日志:从铸渊协作指令主页的「数据桥规范」章节获取
- 📋 变更日志:同上
- 📥 SYSLOG收件箱同上
或者直接问妈妈要三个 Database ID。
</aside>
---
## 🔁 测试通过后
如果三条全通:
1. 铸渊把三个 Database ID 硬编码到 `bridge-syslog-to-notion.yml``bridge-changes-to-notion.yml`
2. 之后每次 push/PR/SYSLOG 都自动推送到 Notion
3. 霜砚这边会定时巡检这三个数据库,自动处理新记录
**数据桥一旦打通 = 妈妈零操作 = GitHub↔Notion 全自动闭环 ✅**
---
## 📝 妈妈操作指南
<aside>
👆
**妈妈你只需要做两件事:**
1. 把三个数据库的 Database ID 告诉铸渊(或让铸渊自己从 Notion URL 里提取)
2. 复制上面代码框里的指令内容,粘贴给铸渊执行
3. 铸渊跑完后告诉霜砚结果,霜砚自动验收
</aside>
---
## 🔗 关联
- 铸渊协作指令主页:[⚒️ 铸渊·协作指令](https://www.notion.so/1e27db07f7884441bf4ca6c931cadab9)
- 数据桥设计文档:[🔧 铸渊协作指令GitHub → Notion 数据桥 v1.0](https://www.notion.so/287fb1e1f2664778905484241588c96b)
- 信号日志数据库:[📡 跨平台信号日志](https://www.notion.so/f983bdc24b654888913ca254160bff33)
- 变更日志数据库:[📋 GitHub 变更日志](https://www.notion.so/e740b77aa6bd4ac0a2e8a75f678fba98)
- SYSLOG收件箱数据库[📥 GitHub SYSLOG 收件箱](https://www.notion.so/330ab17507d542c9bbb96d0749b41197)