mirror of
https://github.com/actions/github-script.git
synced 2026-02-08 12:07:26 +00:00
Make @actions/core accessible to scripts
This commit is contained in:
parent
47683009b7
commit
62c536d2e0
2 changed files with 3 additions and 2 deletions
|
|
@ -11,6 +11,7 @@ be provided:
|
||||||
[octokit/rest.js](https://github.com/octokit/rest.js) client
|
[octokit/rest.js](https://github.com/octokit/rest.js) client
|
||||||
- `context` An object containing the [context of the workflow
|
- `context` An object containing the [context of the workflow
|
||||||
run](https://github.com/actions/toolkit/tree/master/packages/github)
|
run](https://github.com/actions/toolkit/tree/master/packages/github)
|
||||||
|
- `core` Functions for inputs, outputs, results, logging, secrets and variables from [@actions/core](https://github.com/actions/toolkit/blob/master/packages/core)
|
||||||
|
|
||||||
Since the `script` is just a function body, these values will already be
|
Since the `script` is just a function body, these values will already be
|
||||||
defined, so you don't have to (see examples below).
|
defined, so you don't have to (see examples below).
|
||||||
|
|
|
||||||
4
main.js
4
main.js
|
|
@ -16,8 +16,8 @@ async function main() {
|
||||||
if (previews != null) opts.previews = previews.split(',')
|
if (previews != null) opts.previews = previews.split(',')
|
||||||
const client = new GitHub(token, opts)
|
const client = new GitHub(token, opts)
|
||||||
const script = core.getInput('script', {required: true})
|
const script = core.getInput('script', {required: true})
|
||||||
const fn = new AsyncFunction('github', 'context', script)
|
const fn = new AsyncFunction('github', 'context', 'core', script)
|
||||||
const result = await fn(client, context)
|
const result = await fn(client, context, core)
|
||||||
core.setOutput('result', JSON.stringify(result))
|
core.setOutput('result', JSON.stringify(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue