https://github.com/litencatt/notion-db-auto-relator
https://github.com/litencatt/notion-db-auto-relator
notion notion-database
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/litencatt/notion-db-auto-relator
- Owner: litencatt
- License: mit
- Created: 2022-01-17T07:39:04.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-18T00:43:46.000Z (almost 4 years ago)
- Last Synced: 2025-04-10T01:14:48.469Z (8 months ago)
- Topics: notion, notion-database
- Language: TypeScript
- Homepage:
- Size: 65.4 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# notion-db-auto-relator
Create and update relation for Parent and Child DB in Notion automatically.
## Usage
### Setup in Notion
1. Create a parent DB and a child DB that you want to relate automatically.
1. Duplicate this settings DB.
- https://litencatt.notion.site/3dd1ccec8f0740cc90600de413261fdc
1. Create Notion API Integration.
- https://www.notion.so/my-integrations
1. Invite the API Integration to settings DB, Parent DB and Child DB.
### Run `notion-db-auto-relator `locally
```
$ git clone git@github.com:litencatt/notion-db-auto-relator.git
$ cd notion-db-auto-relator
$ yarn
$ NOTION_TOKEN=*** SETTINGS_DB_ID=*** yarn start
```
### Run `notion-db-auto-relator` as GitHub Actions
settings example
```yaml
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 }}
```
### Settings DB examples and relation results
#### Settings DB set values like this,

#### Parent DB and Child DB example

#### Settings1 relation execute result
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 relation execute result
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 relation execute result
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
-- | --
|