mirror of https://github.com/actions/toolkit
Combine exit into core; Remove toolkit (#21)
* Combine exit into core * Remove toolkit * Format * Format * Try to fix diff * Try to fix diff * Format * Add gitattributes * Use unix endings * gitattributes is not a txt file * Renormalize line endingspull/26/head
parent
a327d57760
commit
e85d20fbb0
|
@ -1,4 +1,3 @@
|
||||||
import {ExitCode} from '@actions/exit'
|
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as core from '../src/core'
|
import * as core from '../src/core'
|
||||||
|
@ -121,18 +120,18 @@ describe('@actions/core', () => {
|
||||||
|
|
||||||
it('setNeutral sets the correct exit code', () => {
|
it('setNeutral sets the correct exit code', () => {
|
||||||
core.setFailed('Failure message')
|
core.setFailed('Failure message')
|
||||||
expect(process.exitCode).toBe(ExitCode.Failure)
|
expect(process.exitCode).toBe(core.ExitCode.Failure)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('setFailure sets the correct exit code and failure message', () => {
|
it('setFailure sets the correct exit code and failure message', () => {
|
||||||
core.setFailed('Failure message')
|
core.setFailed('Failure message')
|
||||||
expect(process.exitCode).toBe(ExitCode.Failure)
|
expect(process.exitCode).toBe(core.ExitCode.Failure)
|
||||||
assertWriteCalls([`##[error]Failure message${os.EOL}`])
|
assertWriteCalls([`##[error]Failure message${os.EOL}`])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('setFailure escapes the failure message', () => {
|
it('setFailure escapes the failure message', () => {
|
||||||
core.setFailed('Failure \r\n\nmessage\r')
|
core.setFailed('Failure \r\n\nmessage\r')
|
||||||
expect(process.exitCode).toBe(ExitCode.Failure)
|
expect(process.exitCode).toBe(core.ExitCode.Failure)
|
||||||
assertWriteCalls([`##[error]Failure %0D%0A%0Amessage%0D${os.EOL}`])
|
assertWriteCalls([`##[error]Failure %0D%0A%0Amessage%0D${os.EOL}`])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,5 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^12.0.2"
|
"@types/node": "^12.0.2"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/exit": "^0.0.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {ExitCode} from '@actions/exit'
|
|
||||||
import {issue, issueCommand} from './command'
|
import {issue, issueCommand} from './command'
|
||||||
|
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
@ -11,6 +10,26 @@ export interface InputOptions {
|
||||||
required?: boolean
|
required?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The code to exit an action
|
||||||
|
*/
|
||||||
|
export enum ExitCode {
|
||||||
|
/**
|
||||||
|
* A code indicating that the action was successful
|
||||||
|
*/
|
||||||
|
Success = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A code indicating that the action was a failure
|
||||||
|
*/
|
||||||
|
Failure = 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A code indicating that the action is complete, but neither succeeded nor failed
|
||||||
|
*/
|
||||||
|
Neutral = 78
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Variables
|
// Variables
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
@ -1,7 +0,0 @@
|
||||||
# `@actions/exit`
|
|
||||||
|
|
||||||
> TODO: description
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
See [src/exit.ts](src/exit.ts).
|
|
|
@ -1,21 +0,0 @@
|
||||||
import * as exit from '../src/exit'
|
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
|
||||||
|
|
||||||
it('exits successfully', () => {
|
|
||||||
jest.spyOn(process, 'exit').mockImplementation()
|
|
||||||
exit.success()
|
|
||||||
expect(process.exit).toHaveBeenCalledWith(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('exits as a failure', () => {
|
|
||||||
jest.spyOn(process, 'exit').mockImplementation()
|
|
||||||
exit.failure()
|
|
||||||
expect(process.exit).toHaveBeenCalledWith(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('exits neutrally', () => {
|
|
||||||
jest.spyOn(process, 'exit').mockImplementation()
|
|
||||||
exit.neutral()
|
|
||||||
expect(process.exit).toHaveBeenCalledWith(78)
|
|
||||||
})
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@actions/exit",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"lockfileVersion": 1
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@actions/exit",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"description": "Functions for safely exiting from GitHub Actions",
|
|
||||||
"main": "lib/exit.js",
|
|
||||||
"keywords": [
|
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"toolkit"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exit",
|
|
||||||
"license": "MIT",
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
||||||
"tsc": "tsc"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
/**
|
|
||||||
* The code to exit an action
|
|
||||||
*/
|
|
||||||
export enum ExitCode {
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was successful
|
|
||||||
*/
|
|
||||||
Success = 0,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was a failure
|
|
||||||
*/
|
|
||||||
Failure = 1,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
|
||||||
*/
|
|
||||||
Neutral = 78
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: These exit codes may not behave as expected on the new runtime, due to
|
|
||||||
// complexities of async logging and sync exiting.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exit the action as a success.
|
|
||||||
*/
|
|
||||||
export function success(): void {
|
|
||||||
process.exit(ExitCode.Success)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exit the action as a failure.
|
|
||||||
*/
|
|
||||||
export function failure(): void {
|
|
||||||
process.exit(ExitCode.Failure)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exit the action neither a success or a failure
|
|
||||||
*/
|
|
||||||
export function neutral(): void {
|
|
||||||
process.exit(ExitCode.Neutral)
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "../../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"baseUrl": "./",
|
|
||||||
"outDir": "./lib",
|
|
||||||
"rootDir": "./src"
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"./src"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
@ -1,7 +0,0 @@
|
||||||
# `@actions/toolkit`
|
|
||||||
|
|
||||||
> TODO: description
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
See [src/toolkit.ts](src/toolkit.ts).
|
|
|
@ -1,39 +0,0 @@
|
||||||
import * as exitPkg from '@actions/exit'
|
|
||||||
import {Signale} from 'signale'
|
|
||||||
import {Exit} from '../src/exit'
|
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
|
||||||
|
|
||||||
jest.mock('@actions/exit')
|
|
||||||
|
|
||||||
const tests: [keyof Exit, keyof Signale][] = [
|
|
||||||
['success', 'success'],
|
|
||||||
['neutral', 'info'],
|
|
||||||
['failure', 'fatal']
|
|
||||||
]
|
|
||||||
|
|
||||||
describe.each(tests)('%s', (method, log) => {
|
|
||||||
let logger: Signale
|
|
||||||
let exit: Exit
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
// Create a logger to mock
|
|
||||||
logger = new Signale()
|
|
||||||
logger.success = jest.fn()
|
|
||||||
logger.info = jest.fn()
|
|
||||||
logger.fatal = jest.fn()
|
|
||||||
|
|
||||||
process.exit = jest.fn<never, [number]>()
|
|
||||||
exit = new Exit(logger)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('exits with the expected method', () => {
|
|
||||||
exit[method]()
|
|
||||||
expect(exitPkg[method]).toHaveBeenCalled()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('logs the expected message', () => {
|
|
||||||
exit[method]('hello')
|
|
||||||
expect(logger[log]).toHaveBeenCalledWith('hello')
|
|
||||||
})
|
|
||||||
})
|
|
|
@ -1,52 +0,0 @@
|
||||||
import * as exitPkg from '@actions/exit'
|
|
||||||
import {Signale} from 'signale'
|
|
||||||
import {Toolkit} from '../src/toolkit'
|
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
|
||||||
|
|
||||||
jest.mock('@actions/exit')
|
|
||||||
|
|
||||||
describe('.run', () => {
|
|
||||||
it('runs a sync function', async () => {
|
|
||||||
const cb = jest.fn(() => true)
|
|
||||||
const value = await Toolkit.run(cb)
|
|
||||||
expect(cb).toHaveBeenCalledWith(expect.any(Toolkit))
|
|
||||||
expect(value).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('runs an async function', async () => {
|
|
||||||
const cb = jest.fn(async () => true)
|
|
||||||
const value = await Toolkit.run(cb)
|
|
||||||
expect(cb).toHaveBeenCalledWith(expect.any(Toolkit))
|
|
||||||
expect(value).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('logs and fails when an error occurs', async () => {
|
|
||||||
const err = new Error()
|
|
||||||
const exitFailure = jest.fn()
|
|
||||||
|
|
||||||
await Toolkit.run(async tk => {
|
|
||||||
tk.exit.failure = exitFailure
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(exitFailure).toHaveBeenCalledWith(err)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('asserts required keys are present', async () => {
|
|
||||||
const missingKey = '__DOES_NOT_EXIST__'
|
|
||||||
|
|
||||||
Reflect.deleteProperty(process.env, missingKey)
|
|
||||||
|
|
||||||
const logger = new Signale()
|
|
||||||
logger.fatal = jest.fn()
|
|
||||||
jest.spyOn(process, 'exit').mockImplementation()
|
|
||||||
|
|
||||||
new Toolkit({logger, requiredEnv: [missingKey]})
|
|
||||||
|
|
||||||
expect(exitPkg.failure).toHaveBeenCalled()
|
|
||||||
expect(logger.fatal)
|
|
||||||
.toHaveBeenCalledWith(`The following environment variables are required for this action to run:
|
|
||||||
- __DOES_NOT_EXIST__`)
|
|
||||||
})
|
|
|
@ -1,454 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@actions/toolkit",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"lockfileVersion": 1,
|
|
||||||
"requires": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/endpoint": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-b8sptNUekjREtCTJFpOfSIL4SKh65WaakcyxWzRcSPOk5RxkZJ/S8884NGZFxZ+jCB2rDURU66pSHn14cVgWVg==",
|
|
||||||
"requires": {
|
|
||||||
"deepmerge": "3.2.0",
|
|
||||||
"is-plain-object": "^2.0.4",
|
|
||||||
"universal-user-agent": "^2.0.1",
|
|
||||||
"url-template": "^2.0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@octokit/request": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-DZqmbm66tq+a9FtcKrn0sjrUpi0UaZ9QPUCxxyk/4CJ2rseTMpAWRf6gCwOSUCzZcx/4XVIsDk+kz5BVdaeenA==",
|
|
||||||
"requires": {
|
|
||||||
"@octokit/endpoint": "^4.0.0",
|
|
||||||
"deprecation": "^1.0.1",
|
|
||||||
"is-plain-object": "^2.0.4",
|
|
||||||
"node-fetch": "^2.3.0",
|
|
||||||
"once": "^1.4.0",
|
|
||||||
"universal-user-agent": "^2.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@octokit/rest": {
|
|
||||||
"version": "16.25.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.25.0.tgz",
|
|
||||||
"integrity": "sha512-QKIzP0gNYjyIGmY3Gpm3beof0WFwxFR+HhRZ+Wi0fYYhkEUvkJiXqKF56Pf5glzzfhEwOrggfluEld5F/ZxsKw==",
|
|
||||||
"requires": {
|
|
||||||
"@octokit/request": "3.0.0",
|
|
||||||
"atob-lite": "^2.0.0",
|
|
||||||
"before-after-hook": "^1.4.0",
|
|
||||||
"btoa-lite": "^1.0.0",
|
|
||||||
"deprecation": "^1.0.1",
|
|
||||||
"lodash.get": "^4.4.2",
|
|
||||||
"lodash.set": "^4.3.2",
|
|
||||||
"lodash.uniq": "^4.5.0",
|
|
||||||
"octokit-pagination-methods": "^1.1.0",
|
|
||||||
"once": "^1.4.0",
|
|
||||||
"universal-user-agent": "^2.0.0",
|
|
||||||
"url-template": "^2.0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ansi-styles": {
|
|
||||||
"version": "3.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
|
||||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
|
||||||
"requires": {
|
|
||||||
"color-convert": "^1.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"atob-lite": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY="
|
|
||||||
},
|
|
||||||
"before-after-hook": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-1.4.0.tgz",
|
|
||||||
"integrity": "sha512-l5r9ir56nda3qu14nAXIlyq1MmUSs0meCIaFAh8HwkFwP1F8eToOuS3ah2VAHHcY04jaYD7FpJC5JTXHYRbkzg=="
|
|
||||||
},
|
|
||||||
"btoa-lite": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc="
|
|
||||||
},
|
|
||||||
"chalk": {
|
|
||||||
"version": "2.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
|
||||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-styles": "^3.2.1",
|
|
||||||
"escape-string-regexp": "^1.0.5",
|
|
||||||
"supports-color": "^5.3.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"color-convert": {
|
|
||||||
"version": "1.9.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
|
||||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
|
||||||
"requires": {
|
|
||||||
"color-name": "1.1.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"color-name": {
|
|
||||||
"version": "1.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
|
||||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
|
||||||
},
|
|
||||||
"cross-spawn": {
|
|
||||||
"version": "6.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
|
||||||
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
|
|
||||||
"requires": {
|
|
||||||
"nice-try": "^1.0.4",
|
|
||||||
"path-key": "^2.0.1",
|
|
||||||
"semver": "^5.5.0",
|
|
||||||
"shebang-command": "^1.2.0",
|
|
||||||
"which": "^1.2.9"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"deepmerge": {
|
|
||||||
"version": "3.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-3.2.0.tgz",
|
|
||||||
"integrity": "sha512-6+LuZGU7QCNUnAJyX8cIrlzoEgggTM6B7mm+znKOX4t5ltluT9KLjN6g61ECMS0LTsLW7yDpNoxhix5FZcrIow=="
|
|
||||||
},
|
|
||||||
"deprecation": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-ccVHpE72+tcIKaGMql33x5MAjKQIZrk+3x2GbJ7TeraUCZWHoT+KSZpoC+JQFsUBlSTXUrBaGiF0j6zVTepPLg=="
|
|
||||||
},
|
|
||||||
"end-of-stream": {
|
|
||||||
"version": "1.4.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
|
|
||||||
"integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==",
|
|
||||||
"requires": {
|
|
||||||
"once": "^1.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"error-ex": {
|
|
||||||
"version": "1.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
|
||||||
"integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
|
|
||||||
"requires": {
|
|
||||||
"is-arrayish": "^0.2.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"escape-string-regexp": {
|
|
||||||
"version": "1.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
|
||||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
|
||||||
},
|
|
||||||
"execa": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
|
|
||||||
"requires": {
|
|
||||||
"cross-spawn": "^6.0.0",
|
|
||||||
"get-stream": "^4.0.0",
|
|
||||||
"is-stream": "^1.1.0",
|
|
||||||
"npm-run-path": "^2.0.0",
|
|
||||||
"p-finally": "^1.0.0",
|
|
||||||
"signal-exit": "^3.0.0",
|
|
||||||
"strip-eof": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"figures": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
|
|
||||||
"requires": {
|
|
||||||
"escape-string-regexp": "^1.0.5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"find-up": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
|
|
||||||
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
|
|
||||||
"requires": {
|
|
||||||
"locate-path": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"get-stream": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
|
|
||||||
"requires": {
|
|
||||||
"pump": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"graceful-fs": {
|
|
||||||
"version": "4.1.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
|
|
||||||
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
|
|
||||||
},
|
|
||||||
"has-flag": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
|
||||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
|
|
||||||
},
|
|
||||||
"is-arrayish": {
|
|
||||||
"version": "0.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
|
|
||||||
"integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
|
|
||||||
},
|
|
||||||
"is-plain-object": {
|
|
||||||
"version": "2.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
|
||||||
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
|
|
||||||
"requires": {
|
|
||||||
"isobject": "^3.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"is-stream": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
|
||||||
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
|
|
||||||
},
|
|
||||||
"isexe": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
|
|
||||||
},
|
|
||||||
"isobject": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
|
|
||||||
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8="
|
|
||||||
},
|
|
||||||
"json-parse-better-errors": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
|
|
||||||
},
|
|
||||||
"load-json-file": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
|
|
||||||
"integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=",
|
|
||||||
"requires": {
|
|
||||||
"graceful-fs": "^4.1.2",
|
|
||||||
"parse-json": "^4.0.0",
|
|
||||||
"pify": "^3.0.0",
|
|
||||||
"strip-bom": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"locate-path": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
|
|
||||||
"requires": {
|
|
||||||
"p-locate": "^2.0.0",
|
|
||||||
"path-exists": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lodash.get": {
|
|
||||||
"version": "4.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
|
||||||
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
|
||||||
},
|
|
||||||
"lodash.set": {
|
|
||||||
"version": "4.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz",
|
|
||||||
"integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM="
|
|
||||||
},
|
|
||||||
"lodash.uniq": {
|
|
||||||
"version": "4.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
|
|
||||||
"integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M="
|
|
||||||
},
|
|
||||||
"macos-release": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-iV2IDxZaX8dIcM7fG6cI46uNmHUxHE4yN+Z8tKHAW1TBPMZDIKHf/3L+YnOuj/FK9il14UaVdHmiQ1tsi90ltA=="
|
|
||||||
},
|
|
||||||
"nice-try": {
|
|
||||||
"version": "1.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
|
||||||
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
|
|
||||||
},
|
|
||||||
"node-fetch": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA=="
|
|
||||||
},
|
|
||||||
"npm-run-path": {
|
|
||||||
"version": "2.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
|
|
||||||
"integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
|
|
||||||
"requires": {
|
|
||||||
"path-key": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"octokit-pagination-methods": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz",
|
|
||||||
"integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ=="
|
|
||||||
},
|
|
||||||
"once": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
|
||||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
|
||||||
"requires": {
|
|
||||||
"wrappy": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"os-name": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==",
|
|
||||||
"requires": {
|
|
||||||
"macos-release": "^2.2.0",
|
|
||||||
"windows-release": "^3.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"p-finally": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
|
|
||||||
},
|
|
||||||
"p-limit": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
|
|
||||||
"requires": {
|
|
||||||
"p-try": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"p-locate": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
|
|
||||||
"requires": {
|
|
||||||
"p-limit": "^1.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"p-try": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M="
|
|
||||||
},
|
|
||||||
"parse-json": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
|
|
||||||
"integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
|
|
||||||
"requires": {
|
|
||||||
"error-ex": "^1.3.1",
|
|
||||||
"json-parse-better-errors": "^1.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"path-exists": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
|
||||||
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
|
|
||||||
},
|
|
||||||
"path-key": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
|
|
||||||
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A="
|
|
||||||
},
|
|
||||||
"pify": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
|
||||||
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
|
|
||||||
},
|
|
||||||
"pkg-conf": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz",
|
|
||||||
"integrity": "sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=",
|
|
||||||
"requires": {
|
|
||||||
"find-up": "^2.0.0",
|
|
||||||
"load-json-file": "^4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pump": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
|
||||||
"requires": {
|
|
||||||
"end-of-stream": "^1.1.0",
|
|
||||||
"once": "^1.3.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"semver": {
|
|
||||||
"version": "5.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
|
||||||
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA=="
|
|
||||||
},
|
|
||||||
"shebang-command": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
|
|
||||||
"integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
|
|
||||||
"requires": {
|
|
||||||
"shebang-regex": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"shebang-regex": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM="
|
|
||||||
},
|
|
||||||
"signal-exit": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
|
||||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
|
||||||
},
|
|
||||||
"signale": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/signale/-/signale-1.4.0.tgz",
|
|
||||||
"integrity": "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==",
|
|
||||||
"requires": {
|
|
||||||
"chalk": "^2.3.2",
|
|
||||||
"figures": "^2.0.0",
|
|
||||||
"pkg-conf": "^2.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"strip-bom": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
|
|
||||||
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM="
|
|
||||||
},
|
|
||||||
"strip-eof": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
|
|
||||||
},
|
|
||||||
"supports-color": {
|
|
||||||
"version": "5.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
|
||||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
|
||||||
"requires": {
|
|
||||||
"has-flag": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"universal-user-agent": {
|
|
||||||
"version": "2.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-2.0.3.tgz",
|
|
||||||
"integrity": "sha512-eRHEHhChCBHrZsA4WEhdgiOKgdvgrMIHwnwnqD0r5C6AO8kwKcG7qSku3iXdhvHL3YvsS9ZkSGN8h/hIpoFC8g==",
|
|
||||||
"requires": {
|
|
||||||
"os-name": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"url-template": {
|
|
||||||
"version": "2.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz",
|
|
||||||
"integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE="
|
|
||||||
},
|
|
||||||
"which": {
|
|
||||||
"version": "1.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
|
||||||
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
|
|
||||||
"requires": {
|
|
||||||
"isexe": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"windows-release": {
|
|
||||||
"version": "3.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.2.0.tgz",
|
|
||||||
"integrity": "sha512-QTlz2hKLrdqukrsapKsINzqMgOUpQW268eJ0OaOpJN32h272waxR9fkB9VoWRtK7uKHG5EHJcTXQBD8XZVJkFA==",
|
|
||||||
"requires": {
|
|
||||||
"execa": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"wrappy": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@actions/toolkit",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"description": "Base actions tools for the GitHub API and GitHub context",
|
|
||||||
"keywords": [
|
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"toolkit"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/toolkit",
|
|
||||||
"license": "MIT",
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
||||||
"tsc": "tsc"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/exit": "^0.0.0",
|
|
||||||
"@octokit/rest": "^16.25.0",
|
|
||||||
"signale": "^1.4.0"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
import * as exit from '@actions/exit'
|
|
||||||
import {Signale} from 'signale'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class that wraps some basic methods of exiting from an action
|
|
||||||
*/
|
|
||||||
export class Exit {
|
|
||||||
constructor(private readonly logger: Signale) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop the action with a "success" status.
|
|
||||||
*/
|
|
||||||
success(message?: string): void {
|
|
||||||
if (message) this.logger.success(message)
|
|
||||||
exit.success()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop the action with a "neutral" status.
|
|
||||||
*/
|
|
||||||
neutral(message?: string): void {
|
|
||||||
if (message) this.logger.info(message)
|
|
||||||
exit.neutral()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop the action with a "failed" status.
|
|
||||||
*/
|
|
||||||
failure(message?: string): void {
|
|
||||||
if (message) this.logger.fatal(message)
|
|
||||||
exit.failure()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,96 +0,0 @@
|
||||||
import {LoggerFunc, Signale} from 'signale'
|
|
||||||
import {Exit} from './exit'
|
|
||||||
|
|
||||||
export type ActionFn = (tools: Toolkit) => unknown
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Options used to customize an instance of [[Toolkit]]
|
|
||||||
*/
|
|
||||||
export interface ToolkitOptions {
|
|
||||||
/**
|
|
||||||
* A custom Signale instance to use
|
|
||||||
*/
|
|
||||||
logger?: Signale
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of environment variable names this action requires in order to run
|
|
||||||
*
|
|
||||||
* If any of them are missing, the action will fail and log the missing keys.
|
|
||||||
*/
|
|
||||||
requiredEnv?: string[]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A set of tools for the Actions runtime
|
|
||||||
*/
|
|
||||||
export class Toolkit {
|
|
||||||
/**
|
|
||||||
* Run an asynchronous function that accepts a toolkit as its argument.
|
|
||||||
*
|
|
||||||
* If an error occurs, the error will be logged and the action will exit as a
|
|
||||||
* failure.
|
|
||||||
*/
|
|
||||||
static async run(func: ActionFn, opts?: ToolkitOptions): Promise<void> {
|
|
||||||
const tools = new Toolkit(opts)
|
|
||||||
|
|
||||||
try {
|
|
||||||
const ret = func(tools)
|
|
||||||
return ret instanceof Promise ? await ret : ret
|
|
||||||
} catch (err) {
|
|
||||||
tools.exit.failure(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A logger for the toolkit, an instance of [Signale](https://github.com/klaussinani/signale)
|
|
||||||
*/
|
|
||||||
readonly logger: Signale & LoggerFunc
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A wrapper around an instance of [[Exit]]
|
|
||||||
*/
|
|
||||||
readonly exit: Exit
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The authentication token for the GitHub API
|
|
||||||
*/
|
|
||||||
readonly token: string = process.env.GITHUB_TOKEN || ''
|
|
||||||
|
|
||||||
constructor(opts: ToolkitOptions = {}) {
|
|
||||||
const logger = opts.logger || new Signale({config: {underlineLabel: false}})
|
|
||||||
this.logger = this.wrapLogger(logger)
|
|
||||||
this.exit = new Exit(this.logger)
|
|
||||||
|
|
||||||
if (opts.requiredEnv) {
|
|
||||||
this.checkRequiredEnv(opts.requiredEnv)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ensure that the given keys are in the environment.
|
|
||||||
*/
|
|
||||||
private checkRequiredEnv(keys: string[]): void {
|
|
||||||
const missingEnv = keys.filter(key => !process.env.hasOwnProperty(key))
|
|
||||||
|
|
||||||
if (missingEnv.length === 0) return
|
|
||||||
|
|
||||||
const list = missingEnv.map(key => `- ${key}`).join('\n')
|
|
||||||
|
|
||||||
this.exit.failure(
|
|
||||||
`The following environment variables are required for this action to run:\n${list}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrap a Signale logger so that its a callable class.
|
|
||||||
*/
|
|
||||||
private wrapLogger(logger: Signale): Signale & LoggerFunc {
|
|
||||||
// Create a callable function
|
|
||||||
const fn = logger.info.bind(logger)
|
|
||||||
// Add the log methods onto the function
|
|
||||||
const wrapped = Object.assign(fn, logger)
|
|
||||||
// Clone the prototype
|
|
||||||
Object.setPrototypeOf(wrapped, logger)
|
|
||||||
return wrapped
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "../../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"baseUrl": "./",
|
|
||||||
"outDir": "./lib",
|
|
||||||
"rootDir": "./src"
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"./src"
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue