-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
52 lines (39 loc) · 1.2 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import pino from 'pino'
import * as core from '@actions/core'
import { upsertStatusBoard } from './action.js'
main()
async function main () {
try {
const logger = pino({
level: core.getInput('log-level') || 'debug',
transport: {
target: 'pino-pretty'
}
})
const githubToken = core.getInput('github-token')
const githubRepositoryQuery = core.getInput('github-repository-query')
const githubIssueLabels = core.getInput('github-issue-labels')?.split(',').map(s => s.trim()).filter(e => e)
const notionToken = core.getInput('notion-token')
const databaseId = core.getInput('notion-database-id')
const pageSize = parseInt(core.getInput('page-size'), 10)
if (pageSize < 1 || pageSize > 100) {
throw new Error('page-size must be between 1 and 100')
}
const behavior = {
pageSize,
deleteAdditionalRows: core.getInput('delete-additional-rows') === 'true'
}
await upsertStatusBoard({
logger,
githubToken,
githubRepositoryQuery,
githubIssueLabels,
notionToken,
databaseId,
options: behavior
})
logger.info('Completed')
} catch (error) {
core.setFailed(error.message)
}
}