Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepend newline for set-output #772

Merged
merged 2 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/core/RELEASES.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
9 changes: 6 additions & 3 deletions packages/core/__tests__/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@actions/core",
"version": "1.2.6",
"version": "1.2.7",
"description": "Actions core lib",
"keywords": [
"github",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
thboop marked this conversation as resolved.
Show resolved Hide resolved
issueCommand('set-output', {name}, value)
}

Expand Down