From 3b8c85218c97b679d7b9de606ecef5aae1d0f507 Mon Sep 17 00:00:00 2001 From: eric sciple Date: Tue, 13 Apr 2021 12:01:19 -0500 Subject: [PATCH] Prepend newline for set-output (#772) --- RELEASES.md | 3 +++ __tests__/core.test.ts | 9 ++++++--- package-lock.json | 2 +- package.json | 2 +- src/core.ts | 1 + 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 352efe8..4926ebd 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,5 +1,8 @@ # @actions/core Releases +### 1.2.7 +- [Prepend newline for set-output](https://github.com/actions/toolkit/pull/772) + ### 1.2.6 - [Update `exportVariable` and `addPath` to use environment files](https://github.com/actions/toolkit/pull/571) diff --git a/__tests__/core.test.ts b/__tests__/core.test.ts index 0e52e9b..a069e89 100644 --- a/__tests__/core.test.ts +++ b/__tests__/core.test.ts @@ -159,17 +159,20 @@ describe('@actions/core', () => { it('setOutput produces the correct command', () => { core.setOutput('some output', 'some value') - assertWriteCalls([`::set-output name=some output::some value${os.EOL}`]) + assertWriteCalls([ + os.EOL, + `::set-output name=some output::some value${os.EOL}` + ]) }) it('setOutput handles bools', () => { core.setOutput('some output', false) - assertWriteCalls([`::set-output name=some output::false${os.EOL}`]) + assertWriteCalls([os.EOL, `::set-output name=some output::false${os.EOL}`]) }) it('setOutput handles numbers', () => { core.setOutput('some output', 1.01) - assertWriteCalls([`::set-output name=some output::1.01${os.EOL}`]) + assertWriteCalls([os.EOL, `::set-output name=some output::1.01${os.EOL}`]) }) it('setFailed sets the correct exit code and failure message', () => { diff --git a/package-lock.json b/package-lock.json index a1ede3d..e262592 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@actions/core", - "version": "1.2.6", + "version": "1.2.7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ffcced4..a0e72b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@actions/core", - "version": "1.2.6", + "version": "1.2.7", "description": "Actions core lib", "keywords": [ "github", diff --git a/src/core.ts b/src/core.ts index e7e366c..13f4dfa 100644 --- a/src/core.ts +++ b/src/core.ts @@ -99,6 +99,7 @@ export function getInput(name: string, options?: InputOptions): string { */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export function setOutput(name: string, value: any): void { + process.stdout.write(os.EOL) issueCommand('set-output', {name}, value) }