Create and update relation for Parent and Child DB in Notion automatically.
- Create a parent DB and a child DB that you want to relate automatically.
- Duplicate this settings DB.
- Create Notion API Integration.
- Invite the API Integration to settings DB, Parent DB and Child DB.
$ git clone git@github.com:litencatt/notion-db-auto-relator.git
$ cd notion-db-auto-relator
$ yarn
$ NOTION_TOKEN=*** SETTINGS_DB_ID=*** yarn start
settings example
on:
workflow_dispatch:
schedule:
- cron: '00 * * * *'
jobs:
run-job:
name: run relation
runs-on: ubuntu-latest
env:
TZ: Asia/Tokyo
LANG: ja_JP.UTF-8
steps:
- uses: actions/checkout@v2
- name: Relation
uses: litencatt/notion-db-auto-relator@main
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
SETTINGS_DB_ID: ${{ secrets.SETTINGS_DB_ID }}
Settings1 ✅ and Run actions
or NOTION_TOKEN=*** SETTINGS_DB_ID=*** yarn start
- Relation property
Relation-with-Name
is created to ParentDB. - Related like
ParentDB JOIN ChildDB ON ParentDB.Name = ChildDB.Name
.
Before | After |
---|---|
Settings2 ✅ and Run actions
or NOTION_TOKEN=*** SETTINGS_DB_ID=*** yarn start
- Relation property
Relation with Tags
is created to ParentDB. - Related like
ParentDB JOIN ChildDB ON ParentDB.Tags = ChildDB.Tags
.
Before | After |
---|---|
Settings3 ✅ and Run actions
or NOTION_TOKEN=*** SETTINGS_DB_ID=*** yarn start
- Relation property
Relation with Name,Tags
is created to ParentDB. - Related like
ParentDB JOIN ChildDB ON ParentDB.Name = ChildDB.Name AND ParentDB.Tags = ChildDB.Tags
.
Before | After |
---|---|