author
date
category
tag
summary
前言
GitHub Star 的仓库太多,Star List 管理和检索不便,需要能集中管理并检索的地方。
解决策略
将 GitHub 与 Notion 集成,将 Star 的项目导入到 Notion Database,支持自动打标签并且可以使用 GitHub Actions 定时自动更新。
教程
Fork repository
Fork

Copy Notion Template
Duplicate Template👉Github Notion Star
右上角 Duplicate 将 Notion 模板复制到你的 WorkSpace

Get Secrets
三个 Secrets:
- 要导入 Repo Star 的 Notion 数据库 ID:
NOTION_DATABASE_ID
- Notion Integration Token:
NOTION_API_KEY
- GitHub Personal Access Token:
TOKEN_OF_GITHUB
1.NOTION_DATABASE_ID

点进数据库页面后,输入快捷键 Ctrl + L 即可复制页面链接
如下所示,“?”之前的数字就是数据库ID
NOTION_DATABASE_ID
,复制备用。https://www.notion.so/kinpoeray/186c3aef675f4eb182956e34ecb3c037
?v=20aa449baf384793be88e99b34be31d9&pvs=4
2.NOTION_API_KEY
打开 Notion 的 Intergrations 页面👉https://www.notion.so/profile/integrations
创建新的集成应用,
Integration type
选择 Internal Integration

完善基本信息,点击保存。


Internal Integration Secret
就是NOTION_API_KEY
,复制备用; Capabilities 按如下所示选择,点击保存。
3.TOKEN_OF_GITHUB
点击
Generate token
,生成的 Token
则为 TOKEN_OF_GITHUB
,复制备用
Set Environments Secrets
添加刚刚准备的3个Secrets👉
Settings
- Environments
-Add environment secret

Connect Notion Database Integration
回到目标数据库页面,连接到前面创建的Integration

Run GitHub Actions
回到仓库的 Actions,点击
I understand my workflows, go ahead and enable them
启用 GitHub Actions
,有以下两种同步方式。(我第一次运行错误的原因👉复制了页面 Github Notion Star 的 ID,而不是数据库 Starred Repo 的 ID,这是比较容易忽略的地方)

两种同步方式的控制文件位置👇

FullSync Notion Star
全量更新 Actions,默认设置是限制 2000 个 Star 项目。
可修改
full-sync.yml
文件的 FULLSYNC_LIMIT
参数,如限制数量为 3000Partial Sync Notion Star
增量更新 Actions,默认设置是每 2 个小时运行1次。
可修改
partial-sync.yml
文件的 cron
表达式,如每 12 个小时运行一次你可以根据自己需求启用或修改里面的两个Actions 项目
Demo
我的效果 👉 GitHub Repo Stars
额外增加了 Notion AI 的功能,用最短的文字自动总结仓库内容,这样检索更方便!
