mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Fix artifact-provider zip processing and report name generation
This commit is contained in:
parent
e356ffe9d0
commit
89f214d9f3
3 changed files with 8 additions and 9 deletions
11
dist/index.js
generated
vendored
11
dist/index.js
generated
vendored
|
|
@ -58,7 +58,7 @@ class ArtifactProvider {
|
||||||
}
|
}
|
||||||
let reportName = this.name;
|
let reportName = this.name;
|
||||||
for (let i = 1; i < match.length; i++) {
|
for (let i = 1; i < match.length; i++) {
|
||||||
reportName = reportName.replace(new RegExp(`$${i}`, 'g'), match[i]);
|
reportName = reportName.replace(new RegExp(`\\$${i}`, 'g'), match[i]);
|
||||||
}
|
}
|
||||||
return reportName;
|
return reportName;
|
||||||
};
|
};
|
||||||
|
|
@ -86,7 +86,7 @@ class ArtifactProvider {
|
||||||
}
|
}
|
||||||
for (const art of artifacts) {
|
for (const art of artifacts) {
|
||||||
const fileName = `${art.name}.zip`;
|
const fileName = `${art.name}.zip`;
|
||||||
await github_utils_1.downloadArtifact(this.octokit, art.id, fileName, art.size_in_bytes, this.token);
|
await github_utils_1.downloadArtifact(this.octokit, art.id, fileName, this.token);
|
||||||
core.startGroup(`Reading archive ${fileName}`);
|
core.startGroup(`Reading archive ${fileName}`);
|
||||||
try {
|
try {
|
||||||
const reportName = this.getReportName(art.name);
|
const reportName = this.getReportName(art.name);
|
||||||
|
|
@ -94,7 +94,7 @@ class ArtifactProvider {
|
||||||
const files = [];
|
const files = [];
|
||||||
const zip = new adm_zip_1.default(fileName);
|
const zip = new adm_zip_1.default(fileName);
|
||||||
for (const entry of zip.getEntries()) {
|
for (const entry of zip.getEntries()) {
|
||||||
const file = entry.name;
|
const file = entry.entryName;
|
||||||
if (entry.isDirectory) {
|
if (entry.isDirectory) {
|
||||||
core.info(`Skipping ${file}: entry is a directory`);
|
core.info(`Skipping ${file}: entry is a directory`);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1385,7 +1385,7 @@ function getCheckRunContext() {
|
||||||
return { sha: github.context.sha, runId };
|
return { sha: github.context.sha, runId };
|
||||||
}
|
}
|
||||||
exports.getCheckRunContext = getCheckRunContext;
|
exports.getCheckRunContext = getCheckRunContext;
|
||||||
async function downloadArtifact(octokit, artifactId, fileName, size, token) {
|
async function downloadArtifact(octokit, artifactId, fileName, token) {
|
||||||
core.startGroup(`Downloading artifact ${fileName}`);
|
core.startGroup(`Downloading artifact ${fileName}`);
|
||||||
try {
|
try {
|
||||||
core.info(`Artifact ID: ${artifactId}`);
|
core.info(`Artifact ID: ${artifactId}`);
|
||||||
|
|
@ -1418,8 +1418,7 @@ async function downloadArtifact(octokit, artifactId, fileName, size, token) {
|
||||||
const fileWriterStream = fs_1.createWriteStream(fileName);
|
const fileWriterStream = fs_1.createWriteStream(fileName);
|
||||||
core.info(`Downloading ${url}`);
|
core.info(`Downloading ${url}`);
|
||||||
downloadStream.on('downloadProgress', ({ transferred }) => {
|
downloadStream.on('downloadProgress', ({ transferred }) => {
|
||||||
const percentage = Math.round(transferred / size * 100);
|
core.info(`Progress: ${transferred} B`);
|
||||||
core.info(`Progress: ${transferred}/${size} (${percentage}%)`);
|
|
||||||
});
|
});
|
||||||
await asyncStream(downloadStream, fileWriterStream);
|
await asyncStream(downloadStream, fileWriterStream);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -35,7 +35,7 @@ export class ArtifactProvider implements InputProvider {
|
||||||
}
|
}
|
||||||
let reportName = this.name
|
let reportName = this.name
|
||||||
for (let i = 1; i < match.length; i++) {
|
for (let i = 1; i < match.length; i++) {
|
||||||
reportName = reportName.replace(new RegExp(`$${i}`, 'g'), match[i])
|
reportName = reportName.replace(new RegExp(`\\$${i}`, 'g'), match[i])
|
||||||
}
|
}
|
||||||
return reportName
|
return reportName
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +76,7 @@ export class ArtifactProvider implements InputProvider {
|
||||||
const files: FileContent[] = []
|
const files: FileContent[] = []
|
||||||
const zip = new Zip(fileName)
|
const zip = new Zip(fileName)
|
||||||
for (const entry of zip.getEntries()) {
|
for (const entry of zip.getEntries()) {
|
||||||
const file = entry.name
|
const file = entry.entryName
|
||||||
if (entry.isDirectory) {
|
if (entry.isDirectory) {
|
||||||
core.info(`Skipping ${file}: entry is a directory`)
|
core.info(`Skipping ${file}: entry is a directory`)
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue