2019-04-20 10:52:56 -04:00
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2019-05-21 17:08:25 -04:00
|
|
|
export function success(): void {
|
2019-04-20 10:52:56 -04:00
|
|
|
process.exit(ExitCode.Success)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Exit the action as a failure.
|
|
|
|
|
*/
|
2019-05-21 17:08:25 -04:00
|
|
|
export function failure(): void {
|
2019-04-20 10:52:56 -04:00
|
|
|
process.exit(ExitCode.Failure)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Exit the action neither a success or a failure
|
|
|
|
|
*/
|
2019-05-21 17:08:25 -04:00
|
|
|
export function neutral(): void {
|
2019-04-20 10:52:56 -04:00
|
|
|
process.exit(ExitCode.Neutral)
|
|
|
|
|
}
|