mirror of
https://github.com/actions/github-script.git
synced 2025-12-20 14:22:28 +00:00
Merge pull request #33 from actions/add-core
Add core to execution context
This commit is contained in:
5
.github/workflows/integration.yml
vendored
5
.github/workflows/integration.yml
vendored
@@ -8,9 +8,10 @@ jobs:
|
|||||||
- id: output-set
|
- id: output-set
|
||||||
uses: actions/github-script@master
|
uses: actions/github-script@master
|
||||||
with:
|
with:
|
||||||
script: return 'test'
|
script: return core.getInput('input-value')
|
||||||
result-encoding: string
|
result-encoding: string
|
||||||
|
input-value: output
|
||||||
- run: |
|
- run: |
|
||||||
if [[ "${{steps.output-set.outputs.result}}" != "test" ]]; then
|
if [[ "${{steps.output-set.outputs.result}}" != "output" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -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` A reference to the [@actions/core](https://github.com/actions/toolkit/tree/master/packages/core) package
|
||||||
|
|
||||||
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).
|
||||||
|
|||||||
2
dist/index.js
vendored
2
dist/index.js
vendored
@@ -9178,7 +9178,7 @@ async function main() {
|
|||||||
const github = new lib_github.GitHub(token, opts);
|
const github = new lib_github.GitHub(token, opts);
|
||||||
const script = Object(core.getInput)('script', { required: true });
|
const script = Object(core.getInput)('script', { required: true });
|
||||||
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilatin errors.
|
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilatin errors.
|
||||||
const result = await callAsyncFunction({ require: __webpack_require__(875), github, context: lib_github.context }, script);
|
const result = await callAsyncFunction({ require: __webpack_require__(875), github, context: lib_github.context, core: core }, script);
|
||||||
let encoding = Object(core.getInput)('result-encoding');
|
let encoding = Object(core.getInput)('result-encoding');
|
||||||
encoding = encoding ? encoding : 'json';
|
encoding = encoding ? encoding : 'json';
|
||||||
let output;
|
let output;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ async function main() {
|
|||||||
|
|
||||||
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilatin errors.
|
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilatin errors.
|
||||||
const result = await callAsyncFunction(
|
const result = await callAsyncFunction(
|
||||||
{require: require, github, context},
|
{require: require, github, context, core},
|
||||||
script
|
script
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user