Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f28aef

Browse files
committed
Pass input options to GitHub constructor
1 parent 1aae562 commit 0f28aef

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

main.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ main().catch(handleError)
66

77
async function main() {
88
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor
9-
const script = core.getInput('script', {required: true})
109
const token = core.getInput('github-token', {required: true})
10+
const debug = core.getInput('debug')
11+
const userAgent = core.getInput('user-agent')
12+
const previews = core.getInput('previews')
13+
const opts = {}
14+
if (debug) opts.log = console
15+
if (userAgent) opts.userAgent = userAgent
16+
if (previews) opts.previews = previews
17+
const client = new GitHub(token, opts)
18+
const script = core.getInput('script', {required: true})
1119
const fn = new AsyncFunction('github', 'context', script)
12-
const client = new GitHub(token)
1320
const result = await fn(client, context)
1421
core.setOutput('result', JSON.stringify(result))
1522
}

0 commit comments

Comments
 (0)