Skip to content

Commit

Permalink
Support coma separated list of paths to test reports
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Dorner committed Jan 24, 2021
1 parent 40b5f47 commit 0ce114d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ jobs:
# Name of the Check Run which will be created
name: ''

# Path to test report
# Coma separated list of paths to test reports
# Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
# Path may match multiple result files of same format
# All matched result files must be of same format
path: ''

# Format of test report. Supported options:
Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ inputs:
description: Name of the check run
required: true
path:
description: Path to test report
description: |
Coma separated list of paths to test reports
Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
All matched files must be of same format
required: true
reporter:
description: |
Expand Down
7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,17 @@ function getParser(reporter: string): ParseTestResult {
}

export async function getFiles(pattern: string): Promise<FileContent[]> {
const paths = await glob(pattern, {dot: true})
return Promise.all(
const paths = (await Promise.all(pattern.split(',').map(async pat => glob(pat, {dot: true})))).flat()

const files = Promise.all(
paths.map(async path => {
core.info(`Reading test report '${path}'`)
const content = await fs.promises.readFile(path, {encoding: 'utf8'})
return {path, content}
})
)

return files
}

run()

0 comments on commit 0ce114d

Please sign in to comment.