mirror of
https://github.com/actions/github-script.git
synced 2025-12-09 00:26:20 +00:00
Pass input options to GitHub constructor
This commit is contained in:
11
main.js
11
main.js
@@ -6,10 +6,17 @@ main().catch(handleError)
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor
|
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor
|
||||||
const script = core.getInput('script', {required: true})
|
|
||||||
const token = core.getInput('github-token', {required: true})
|
const token = core.getInput('github-token', {required: true})
|
||||||
|
const debug = core.getInput('debug')
|
||||||
|
const userAgent = core.getInput('user-agent')
|
||||||
|
const previews = core.getInput('previews')
|
||||||
|
const opts = {}
|
||||||
|
if (debug) opts.log = console
|
||||||
|
if (userAgent) opts.userAgent = userAgent
|
||||||
|
if (previews) opts.previews = previews
|
||||||
|
const client = new GitHub(token, opts)
|
||||||
|
const script = core.getInput('script', {required: true})
|
||||||
const fn = new AsyncFunction('github', 'context', script)
|
const fn = new AsyncFunction('github', 'context', script)
|
||||||
const client = new GitHub(token)
|
|
||||||
const result = await fn(client, context)
|
const result = await fn(client, context)
|
||||||
core.setOutput('result', JSON.stringify(result))
|
core.setOutput('result', JSON.stringify(result))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user