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 endings
This commit is contained in:
Danny McCormick
2019-06-25 13:54:41 -04:00
committed by GitHub
parent a327d57760
commit e85d20fbb0
19 changed files with 23 additions and 873 deletions

View File

@@ -1,4 +1,3 @@
import {ExitCode} from '@actions/exit'
import * as os from 'os'
import * as path from 'path'
import * as core from '../src/core'
@@ -121,18 +120,18 @@ describe('@actions/core', () => {
it('setNeutral sets the correct exit code', () => {
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', () => {
core.setFailed('Failure message')
expect(process.exitCode).toBe(ExitCode.Failure)
expect(process.exitCode).toBe(core.ExitCode.Failure)
assertWriteCalls([`##[error]Failure message${os.EOL}`])
})
it('setFailure escapes the failure message', () => {
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}`])
})

View File

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

View File

@@ -1,4 +1,3 @@
import {ExitCode} from '@actions/exit'
import {issue, issueCommand} from './command'
import * as path from 'path'
@@ -11,6 +10,26 @@ export interface InputOptions {
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
//-----------------------------------------------------------------------