mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-05-04 10:08:05 +08:00
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:
@@ -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}`])
|
||||
})
|
||||
|
||||
|
||||
@@ -32,8 +32,5 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/exit": "^0.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user