Skip to content

Commit 791dfa1

Browse files
committed
Added non uuid id input
1 parent 9cdbf7f commit 791dfa1

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ jobs:
4747
uses: 'devorein/github-readme-learn-section-notion@master'
4848
with:
4949
database_id: '6626c1ebc5a44db78e3f2fe285171ab7'
50-
token_v2: ${{ secrets.NOTION_TOKEN_V2 }}
50+
token_v2: ${{ secrets.NOTION_TOKEN_V2 }} # Required only if your database is private
5151
```
5252
53+
**TIP**: You can test out using [this template](https://www.notion.so/devorein/6c46c1ebc5a44db78e3f5fe285071ab6?v=0bc36e7c59e54f34b0838956e35b4490) that I've created.
54+
5355
### In your notion account
5456
5557
#### 1. Create a full page database
@@ -75,7 +77,15 @@ with:
7577
database_id: '6626c1ebc5a44db78e3f2fe285171ab7'
7678
```
7779

78-
#### 4. Get your notion `token_v2`
80+
Follow the rest of the steps only if your database is not public, if its public you don't need to set the token_v2
81+
82+
#### To make your database public
83+
84+
1. Navigate to the database in your notion account
85+
2. Click on Share at the top right corner
86+
3. Click on Share to Web button.
87+
88+
#### 1. Get your notion `token_v2`
7989

8090
**NOTE**: By no means should you share or expose your notion `token_v2`. If you feel like you've done so accidentally, immediately log out from that account in all of your devices.
8191

@@ -87,7 +97,7 @@ Follow the steps below to obtain your `token_v2`:
8797

8898
**NOTE**: Its highly recommended to store your `token_v2` as a github secret rather than pasting it in your workflow file.
8999

90-
#### 5. Create a github secret to store `token_v2`
100+
#### 2. Create a github secret to store `token_v2`
91101

92102
1. navigate to the url `https://github.com/<USERNAME>/<REPO-NAME>/settings/secrets/actions`
93103
2. Click on `New repository secret`

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ inputs:
77
description: "The id of the database"
88
required: true
99
token_v2:
10-
description: "Your notion token_v2 string"
11-
required: true
10+
description: "Your notion token_v2 string, required only for private databases"
11+
required: false
1212

1313
branding:
1414
icon: "box"

src/action.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { ActionUtils } from './utils';
66

77
export async function action() {
88
const NOTION_TOKEN_V2 = core.getInput('token_v2');
9-
const databaseId = core.getInput('database_id');
9+
let id = core.getInput('database_id').replace(/-/g, '');
10+
const databaseId = `${id.substr(0, 8)}-${id.substr(8, 4)}-${id.substr(
11+
12,
12+
4
13+
)}-${id.substr(16, 4)}-${id.substr(20)}`;
1014

1115
const collectionView = await ActionUtils.fetchData<TCollectionBlock>(
1216
databaseId,

0 commit comments

Comments
 (0)