Skip to content

Commit

Permalink
Filtering empty paths
Browse files Browse the repository at this point in the history
  • Loading branch information
thsaravana committed Jul 24, 2023
1 parent 37b3821 commit 6b8f1ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16988,11 +16988,13 @@ async function getJsonReports(xmlPaths, debugMode) {
const paths = xmlPaths.map((xmlPath) => globSync(xmlPath))
if (debugMode) core.info(`paths: ${paths}`)
return Promise.all(
paths.map(async (path) => {
if (debugMode) core.info(`path: ${path}`)
const reportXml = await fs.promises.readFile(path.trim(), 'utf-8')
return await parser.parseStringPromise(reportXml)
})
paths
.filter((path) => path && path.length !== 0)
.map(async (path) => {
if (debugMode) core.info(`path: ${path}`)
const reportXml = await fs.promises.readFile(path.trim(), 'utf-8')
return await parser.parseStringPromise(reportXml)
})
)
}

Expand Down
12 changes: 7 additions & 5 deletions src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ async function getJsonReports(xmlPaths, debugMode) {
const paths = xmlPaths.map((xmlPath) => globSync(xmlPath))
if (debugMode) core.info(`paths: ${paths}`)
return Promise.all(
paths.map(async (path) => {
if (debugMode) core.info(`path: ${path}`)
const reportXml = await fs.promises.readFile(path.trim(), 'utf-8')
return await parser.parseStringPromise(reportXml)
})
paths
.filter((path) => path && path.length !== 0)
.map(async (path) => {
if (debugMode) core.info(`path: ${path}`)
const reportXml = await fs.promises.readFile(path.trim(), 'utf-8')
return await parser.parseStringPromise(reportXml)
})
)
}

Expand Down

0 comments on commit 6b8f1ae

Please sign in to comment.