Include @actions/io

This commit is contained in:
Jason Macgowan
2020-05-18 15:56:00 -04:00
parent 048309c447
commit b2c461f3a2
6 changed files with 517 additions and 4 deletions
+1
View File
@@ -12,6 +12,7 @@ arguments will be provided:
- `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 - `core` A reference to the [@actions/core](https://github.com/actions/toolkit/tree/master/packages/core) package
- `io` A reference to the [@actions/io](https://github.com/actions/toolkit/tree/master/packages/io) 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).
+505 -2
View File
File diff suppressed because one or more lines are too long
+5
View File
@@ -27,6 +27,11 @@
"tunnel": "0.0.6" "tunnel": "0.0.6"
} }
}, },
"@actions/io": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz",
"integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg=="
},
"@babel/code-frame": { "@babel/code-frame": {
"version": "7.5.5", "version": "7.5.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
+2 -1
View File
@@ -36,7 +36,8 @@
}, },
"dependencies": { "dependencies": {
"@actions/core": "^1.2.4", "@actions/core": "^1.2.4",
"@actions/github": "^2.2.0" "@actions/github": "^2.2.0",
"@actions/io": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^25.1.4", "@types/jest": "^25.1.4",
+2
View File
@@ -1,6 +1,7 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {GitHub} from '@actions/github' import {GitHub} from '@actions/github'
import {Context} from '@actions/github/lib/context' import {Context} from '@actions/github/lib/context'
import * as io from '@actions/io'
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor const AsyncFunction = Object.getPrototypeOf(async () => null).constructor
@@ -8,6 +9,7 @@ type AsyncFunctionArguments = {
context: Context context: Context
core: typeof core core: typeof core
github: GitHub github: GitHub
io: typeof io
require: NodeRequire require: NodeRequire
} }
+2 -1
View File
@@ -1,5 +1,6 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {context, GitHub} from '@actions/github' import {context, GitHub} from '@actions/github'
import * as io from '@actions/io'
import {callAsyncFunction} from './async-function' import {callAsyncFunction} from './async-function'
process.on('unhandledRejection', handleError) process.on('unhandledRejection', handleError)
@@ -27,7 +28,7 @@ async function main(): Promise<void> {
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors. // Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
const result = await callAsyncFunction( const result = await callAsyncFunction(
{require: require, github, context, core}, {require: require, github, context, core, io},
script script
) )