mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 14:27:10 +01:00
artifact-provider: improve logging
This commit is contained in:
parent
da9cc2c0d9
commit
1ae86a176d
4 changed files with 65 additions and 35 deletions
|
|
@ -67,20 +67,35 @@ export class ArtifactProvider implements InputProvider {
|
|||
}
|
||||
|
||||
for (const art of artifacts) {
|
||||
await downloadArtifact(this.octokit, art.id, art.name, art.size_in_bytes, this.token)
|
||||
const reportName = this.getReportName(art.name)
|
||||
const files: FileContent[] = []
|
||||
const zip = new Zip(art.name)
|
||||
for (const entry of zip.getEntries()) {
|
||||
const file = entry.name
|
||||
if (entry.isDirectory || !this.fileNameMatch(file)) continue
|
||||
const content = zip.readAsText(entry)
|
||||
files.push({file, content})
|
||||
}
|
||||
if (result[reportName]) {
|
||||
result[reportName].push(...files)
|
||||
} else {
|
||||
result[reportName] = files
|
||||
const fileName = `${art.name}.zip`
|
||||
await downloadArtifact(this.octokit, art.id, fileName, art.size_in_bytes, this.token)
|
||||
core.startGroup(`Reading archive ${fileName}`)
|
||||
try {
|
||||
const reportName = this.getReportName(art.name)
|
||||
core.info(`Report name: ${reportName}`)
|
||||
const files: FileContent[] = []
|
||||
const zip = new Zip(fileName)
|
||||
for (const entry of zip.getEntries()) {
|
||||
const file = entry.name
|
||||
if (entry.isDirectory) {
|
||||
core.info(`Skipping ${file}: entry is a directory`)
|
||||
continue
|
||||
}
|
||||
if (!this.fileNameMatch(file)) {
|
||||
core.info(`Skipping ${file}: filename does not match pattern`)
|
||||
continue
|
||||
}
|
||||
const content = zip.readAsText(entry)
|
||||
files.push({file, content})
|
||||
core.info(`Read ${file}: ${content.length} chars`)
|
||||
}
|
||||
if (result[reportName]) {
|
||||
result[reportName].push(...files)
|
||||
} else {
|
||||
result[reportName] = files
|
||||
}
|
||||
} finally {
|
||||
core.endGroup()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue