Skip to content

Commit

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

0 comments on commit 33ad78e

Please sign in to comment.