Skip to content

Commit 4d2b828

Browse files
authored
Merge pull request #2 from actions/client-options
Add client options
2 parents a113cca + fbe453a commit 4d2b828

25 files changed

+688
-574
lines changed

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ inputs:
1010
github-token:
1111
description: The GitHub token used to create an authenticated client
1212
required: true
13+
debug:
14+
description: Whether to tell the GitHub client to log details of its requests
15+
default: false
16+
user-agent:
17+
description: An optional user-agent string
18+
default: actions/github-script
19+
previews:
20+
description: A comma-separated list of API previews to accept
1321
outputs:
1422
result:
1523
description: The return value of the script, stringified with `JSON.stringify`

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 === 'true') opts.log = console
15+
if (userAgent != null) opts.userAgent = userAgent
16+
if (previews != null) opts.previews = previews.split(',')
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
}

node_modules/.yarn-integrity

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/LICENSE.md

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/README.md

Lines changed: 97 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/command.d.ts

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)