-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (34 loc) · 919 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import core from '@actions/core'
import { Client } from '@notionhq/client'
const notionApiToken = core.getInput('notion-api-token')
const notionDatabaseId = core.getInput('notion-database-id')
const releaseVersion = core.getInput('release-version')
const releaseDate = core.getInput('release-date')
const notion = new Client({ auth: notionApiToken })
try {
console.log('Creating Notion database page', {
notionDatabaseId,
releaseVersion,
releaseDate,
})
const result = await notion.pages.create({
parent: {
type: 'database_id',
database_id: notionDatabaseId,
},
properties: {
Version: {
type: 'title',
title: [{ type: 'text', text: { content: releaseVersion } }],
},
'Release Date': {
type: 'date',
date: { start: releaseDate },
},
},
})
console.log('Notion database page created', result)
} catch (error) {
console.error(error)
core.setFailed(error.message)
}