fix: bug with outputs when json is set to true (#1531)

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
Tonye Jack
2023-09-04 14:03:32 -06:00
committed by GitHub
parent fd460fa3ba
commit 8d335b7b7d
7 changed files with 362 additions and 150 deletions

View File

@@ -268,20 +268,15 @@ export const getChangeTypeFiles = async ({
inputs: Inputs
changedFiles: ChangedFiles
changeTypes: ChangeTypeEnum[]
}): Promise<{paths: string; count: string}> => {
}): Promise<{paths: string[] | string; count: string}> => {
const files = [
...new Set(getChangeTypeFilesGenerator({inputs, changedFiles, changeTypes}))
].filter(Boolean)
if (inputs.json) {
return {
paths: jsonOutput({value: files, shouldEscape: inputs.escapeJson}),
count: files.length.toString()
}
}
const paths = inputs.json ? files : files.join(inputs.separator)
return {
paths: files.join(inputs.separator),
paths,
count: files.length.toString()
}
}
@@ -317,20 +312,15 @@ export const getAllChangeTypeFiles = async ({
}: {
inputs: Inputs
changedFiles: ChangedFiles
}): Promise<{paths: string; count: string}> => {
}): Promise<{paths: string[] | string; count: string}> => {
const files = [
...new Set(getAllChangeTypeFilesGenerator({inputs, changedFiles}))
].filter(Boolean)
if (inputs.json) {
return {
paths: jsonOutput({value: files, shouldEscape: inputs.escapeJson}),
count: files.length.toString()
}
}
const paths = inputs.json ? files : files.join(inputs.separator)
return {
paths: files.join(inputs.separator),
paths,
count: files.length.toString()
}
}