Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rentziass committed Sep 28, 2022
1 parent 44f5f95 commit 28f9431
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {issue, issueCommand} from './command'
import {
issueCommand as issueFileCommand,
prepareKeyValueMessage as prepareCommandValue
} from './file-command'
import {issueFileCommand, prepareKeyValueMessage} from './file-command'
import {toCommandProperties, toCommandValue} from './utils'

import * as os from 'os'
Expand Down Expand Up @@ -89,7 +86,7 @@ export function exportVariable(name: string, val: any): void {

const filePath = process.env['GITHUB_ENV'] || ''
if (filePath) {
return issueFileCommand('ENV', prepareCommandValue(name, val))
return issueFileCommand('ENV', prepareKeyValueMessage(name, val))
}

issueCommand('set-env', {name}, convertedVal)
Expand Down Expand Up @@ -195,7 +192,7 @@ export function getBooleanInput(name: string, options?: InputOptions): boolean {
export function setOutput(name: string, value: any): void {
const filePath = process.env['GITHUB_OUTPUT'] || ''
if (filePath) {
return issueFileCommand('OUTPUT', prepareCommandValue(name, value))
return issueFileCommand('OUTPUT', prepareKeyValueMessage(name, value))
}

process.stdout.write(os.EOL)
Expand Down Expand Up @@ -355,7 +352,7 @@ export async function group<T>(name: string, fn: () => Promise<T>): Promise<T> {
export function saveState(name: string, value: any): void {
const filePath = process.env['GITHUB_STATE'] || ''
if (filePath) {
return issueFileCommand('STATE', prepareCommandValue(name, value))
return issueFileCommand('STATE', prepareKeyValueMessage(name, value))
}

issueCommand('save-state', {name}, toCommandValue(value))
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/file-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as os from 'os'
import {v4 as uuidv4} from 'uuid'
import {toCommandValue} from './utils'

export function issueCommand(command: string, message: any): void {
export function issueFileCommand(command: string, message: any): void {
const filePath = process.env[`GITHUB_${command}`]
if (!filePath) {
throw new Error(
Expand Down

0 comments on commit 28f9431

Please sign in to comment.