Updated use of deletedFilesPaths

This commit is contained in:
Tonye Jack 2023-09-22 09:56:45 -06:00
parent 1be42003d7
commit 543c1a25c6

View File

@ -397,16 +397,24 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
inputs.dirNames && inputs.dirNames &&
workingDirectory workingDirectory
) { ) {
const deletedFilesPaths: string[] = [] const newDeletedFilesPaths: string[] = []
for (const deletedPath of getArrayFromPaths(deletedFiles.paths, inputs)) { for (const deletedPath of getArrayFromPaths(deletedFiles.paths, inputs)) {
if (!(await exists(path.join(workingDirectory, deletedPath)))) { if (!(await exists(path.join(workingDirectory, deletedPath)))) {
deletedFilesPaths.push(deletedPath) newDeletedFilesPaths.push(deletedPath)
} }
} }
deletedFiles.paths = deletedFilesPaths deletedFiles.paths = inputs.json
deletedFiles.count = deletedFilesPaths.length.toString() ? newDeletedFilesPaths
: newDeletedFilesPaths.join(inputs.separator)
deletedFiles.count = newDeletedFilesPaths.length.toString()
} }
const deletedFilesPaths: string[] = getArrayFromPaths(
deletedFiles.paths,
inputs
)
const deletedFilesCount = deletedFilesPaths.length.toString()
await setOutput({ await setOutput({
key: getOutputKey('deleted_files', outputPrefix), key: getOutputKey('deleted_files', outputPrefix),
value: deletedFiles.paths, value: deletedFiles.paths,
@ -418,14 +426,14 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
await setOutput({ await setOutput({
key: getOutputKey('deleted_files_count', outputPrefix), key: getOutputKey('deleted_files_count', outputPrefix),
value: deletedFiles.count, value: deletedFilesCount,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
}) })
await setOutput({ await setOutput({
key: getOutputKey('any_deleted', outputPrefix), key: getOutputKey('any_deleted', outputPrefix),
value: deletedFiles.paths.length > 0 && filePatterns.length > 0, value: deletedFilesPaths.length > 0 && filePatterns.length > 0,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
json: inputs.json json: inputs.json
@ -442,11 +450,6 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
inputs inputs
) )
const deletedFilesPaths: string[] = getArrayFromPaths(
deletedFiles.paths,
inputs
)
const otherDeletedFiles = allOtherDeletedFilesPaths.filter( const otherDeletedFiles = allOtherDeletedFilesPaths.filter(
filePath => !deletedFilesPaths.includes(filePath) filePath => !deletedFilesPaths.includes(filePath)
) )