diff --git a/dist/src/write.js b/dist/src/write.js index e3cd67704..e0abaf383 100644 --- a/dist/src/write.js +++ b/dist/src/write.js @@ -150,11 +150,11 @@ function commentFooter() { const actionUrl = repoUrl + '/actions?query=workflow%3A' + encodeURIComponent(github.context.workflow); return `This comment was automatically generated by [workflow](${actionUrl}) using [github-action-benchmark](https://github.com/marketplace/actions/continuous-benchmark).`; } -function buildComment(benchName, curSuite, prevSuite) { +function buildComment(benchName, curSuite, prevSuite, expandableDetails = true) { const lines = [ `# ${benchName}`, '', - '
', + expandableDetails ? '
' : '', '', `| Benchmark suite | Current: ${curSuite.commit.id} | Previous: ${prevSuite.commit.id} | Ratio |`, '|-|-|-|-|', @@ -174,7 +174,7 @@ function buildComment(benchName, curSuite, prevSuite) { lines.push(line); } // Footer - lines.push('', '
', '', commentFooter()); + lines.push('', expandableDetails ? '
' : '', '', commentFooter()); return lines.join('\n'); } function buildAlertComment(alerts, benchName, curSuite, prevSuite, threshold, cc) { @@ -457,63 +457,10 @@ async function handleSummary(benchName, currBench, prevBench, config) { core.debug('Summary was skipped because summary-always is disabled'); return; } - const headers = [ - { - data: 'Benchmark Suite', - header: true, - }, - { - data: `Current: "${currBench.commit.id}"`, - header: true, - }, - { - data: `Previous: "${prevBench.commit.id}"`, - header: true, - }, - { - data: 'Ratio', - header: true, - }, - ]; - const rows = currBench.benches.map((bench) => { - const previousBench = prevBench.benches.find((pb) => pb.name === bench.name); - if (previousBench) { - const ratio = biggerIsBetter(config.tool) - ? previousBench.value / bench.value - : bench.value / previousBench.value; - return [ - { - data: bench.name, - }, - { - data: strVal(bench), - }, - { - data: strVal(previousBench), - }, - { - data: floatStr(ratio), - }, - ]; - } - return [ - { - data: bench.name, - }, - { - data: strVal(bench), - }, - { - data: '-', - }, - { - data: '-', - }, - ]; - }); - await core.summary - .addHeading(`Benchmarks: ${benchName}`) - .addTable([headers, ...rows]) - .write(); + const body = buildComment(benchName, currBench, prevBench, false); + const summary = core.summary.addRaw(body); + core.debug('Writing a summary about benchmark comparison'); + core.debug(summary.stringify()); + await summary.write(); } //# sourceMappingURL=write.js.map \ No newline at end of file