mirror of https://github.com/actions/toolkit
Remove neutral exit code references
parent
da76d1fd39
commit
3004de4b40
|
@ -43,18 +43,13 @@ core.addPath('pathToTool');
|
||||||
|
|
||||||
#### Exit codes
|
#### Exit codes
|
||||||
|
|
||||||
You should use this library to set the exit code for your action:
|
You should use this library to set the failing exit code for your action:
|
||||||
|
|
||||||
```
|
```
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (work to do) {
|
// Do stuff
|
||||||
// Do work
|
|
||||||
} else {
|
|
||||||
// Set neutral indicates that the action terminated but did not fail (aka there was no work to be done)
|
|
||||||
core.setNeutral();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
// setFailed logs the message and sets a failing exit code
|
// setFailed logs the message and sets a failing exit code
|
||||||
|
|
|
@ -22,12 +22,7 @@ export enum ExitCode {
|
||||||
/**
|
/**
|
||||||
* A code indicating that the action was a failure
|
* A code indicating that the action was a failure
|
||||||
*/
|
*/
|
||||||
Failure = 1,
|
Failure = 1
|
||||||
|
|
||||||
/**
|
|
||||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
|
||||||
*/
|
|
||||||
Neutral = 78
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
@ -94,13 +89,6 @@ export function setOutput(name: string, value: string): void {
|
||||||
// Results
|
// Results
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the action status to neutral
|
|
||||||
*/
|
|
||||||
export function setNeutral(): void {
|
|
||||||
process.exitCode = ExitCode.Neutral
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the action status to failed.
|
* Sets the action status to failed.
|
||||||
* When the action exits it will be with an exit code of 1
|
* When the action exits it will be with an exit code of 1
|
||||||
|
|
Loading…
Reference in New Issue