diff --git a/packages/core/package.json b/packages/core/package.json index 3f39447a..df9eb6b7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -33,5 +33,8 @@ }, "devDependencies": { "@types/node": "^12.0.2" + }, + "dependencies": { + "@actions/exit": "^0.0.0" } } diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index f0e1e105..d34d8077 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -1,6 +1,14 @@ -import * as im from './interfaces' +import {ExitCode} from '@actions/exit' import * as intm from './internal' +/** + * Interface for getInput options + */ +export interface InputOptions { + /** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */ + required?: boolean +} + //----------------------------------------------------------------------- // Variables //----------------------------------------------------------------------- @@ -50,7 +58,7 @@ export function getInput(name: string, options?: im.InputOptions): string { * Sets the action status to neutral */ export function setNeutral() { - process.exitCode = im.ExitCode.Neutral + process.exitCode = ExitCode.Neutral } /** @@ -59,7 +67,7 @@ export function setNeutral() { * @param message add error issue message */ export function setFailed(message: string) { - process.exitCode = im.ExitCode.Failure + process.exitCode = ExitCode.Failure error(message) } diff --git a/packages/core/src/interfaces.ts b/packages/core/src/interfaces.ts deleted file mode 100644 index 247f8e99..00000000 --- a/packages/core/src/interfaces.ts +++ /dev/null @@ -1,27 +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 -} - -/** - * Interface for getInput options - */ -export interface InputOptions { - /** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */ - required?: boolean -}