1
0
Fork 0

Merge pull request #22 from actions/set-output

add set-output command
pull/26/head
Matt Cooper 2019-06-25 08:43:40 -04:00 committed by GitHub
commit a5bf0d7400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -114,6 +114,11 @@ describe('@actions/core', () => {
expect(core.getInput('special chars_\'\t"\\')).toBe('\'\t"\\ repsonse') expect(core.getInput('special chars_\'\t"\\')).toBe('\'\t"\\ repsonse')
}) })
it('setOutput produces the correct command', () => {
core.setOutput('some output', 'some value')
assertWriteCalls([`##[set-output name=some output;]some value${os.EOL}`])
})
it('setNeutral sets the correct exit code', () => { it('setNeutral sets the correct exit code', () => {
core.setFailed('Failure message') core.setFailed('Failure message')
expect(process.exitCode).toBe(ExitCode.Failure) expect(process.exitCode).toBe(ExitCode.Failure)

View File

@ -61,6 +61,16 @@ export function getInput(name: string, options?: InputOptions): string {
return val.trim() return val.trim()
} }
/**
* Sets the value of an output.
*
* @param name name of the output to set
* @param value value to store
*/
export function setOutput(name: string, value: string): void {
issueCommand('set-output', {name}, value)
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// Results // Results
//----------------------------------------------------------------------- //-----------------------------------------------------------------------