1
0
Fork 0

Use ExitCode from @actions/exit

pull/4/head
Jonathan Clem 2019-05-21 12:00:23 -04:00
parent 90008fc46b
commit 062a6bb046
No known key found for this signature in database
GPG Key ID: 48C5B22E9FD6E80F
3 changed files with 14 additions and 30 deletions

View File

@ -33,5 +33,8 @@
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^12.0.2" "@types/node": "^12.0.2"
},
"dependencies": {
"@actions/exit": "^0.0.0"
} }
} }

View File

@ -1,6 +1,14 @@
import * as im from './interfaces' import {ExitCode} from '@actions/exit'
import * as intm from './internal' 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 // Variables
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
@ -50,7 +58,7 @@ export function getInput(name: string, options?: im.InputOptions): string {
* Sets the action status to neutral * Sets the action status to neutral
*/ */
export function setNeutral() { 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 * @param message add error issue message
*/ */
export function setFailed(message: string) { export function setFailed(message: string) {
process.exitCode = im.ExitCode.Failure process.exitCode = ExitCode.Failure
error(message) error(message)
} }

View File

@ -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
}