Merge pull request #589 from OlesGalatsan/features/add-step-summary-short-summary

This commit is contained in:
Jozef Izso
2025-06-08 12:59:33 +02:00
committed by GitHub
2 changed files with 11 additions and 9 deletions

9
dist/index.js generated vendored
View File

@@ -402,6 +402,10 @@ class TestReporter {
} }
} }
const { listSuites, listTests, onlySummary, useActionsSummary, badgeTitle, reportTitle } = this; const { listSuites, listTests, onlySummary, useActionsSummary, badgeTitle, reportTitle } = this;
const passed = results.reduce((sum, tr) => sum + tr.passed, 0);
const failed = results.reduce((sum, tr) => sum + tr.failed, 0);
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0);
const shortSummary = `${passed} passed, ${failed} failed and ${skipped} skipped `;
let baseUrl = ''; let baseUrl = '';
if (this.useActionsSummary) { if (this.useActionsSummary) {
const summary = (0, get_report_1.getReport)(results, { const summary = (0, get_report_1.getReport)(results, {
@@ -415,6 +419,7 @@ class TestReporter {
}); });
core.info('Summary content:'); core.info('Summary content:');
core.info(summary); core.info(summary);
core.summary.addRaw(`# ${shortSummary}`);
await core.summary.addRaw(summary).write(); await core.summary.addRaw(summary).write();
} }
else { else {
@@ -444,10 +449,6 @@ class TestReporter {
const annotations = (0, get_annotations_1.getAnnotations)(results, this.maxAnnotations); const annotations = (0, get_annotations_1.getAnnotations)(results, this.maxAnnotations);
const isFailed = this.failOnError && results.some(tr => tr.result === 'failed'); const isFailed = this.failOnError && results.some(tr => tr.result === 'failed');
const conclusion = isFailed ? 'failure' : 'success'; const conclusion = isFailed ? 'failure' : 'success';
const passed = results.reduce((sum, tr) => sum + tr.passed, 0);
const failed = results.reduce((sum, tr) => sum + tr.failed, 0);
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0);
const shortSummary = `${passed} passed, ${failed} failed and ${skipped} skipped `;
core.info(`Updating check run conclusion (${conclusion}) and output`); core.info(`Updating check run conclusion (${conclusion}) and output`);
const resp = await this.octokit.rest.checks.update({ const resp = await this.octokit.rest.checks.update({
check_run_id: createResp.data.id, check_run_id: createResp.data.id,

View File

@@ -168,6 +168,11 @@ class TestReporter {
const {listSuites, listTests, onlySummary, useActionsSummary, badgeTitle, reportTitle} = this const {listSuites, listTests, onlySummary, useActionsSummary, badgeTitle, reportTitle} = this
const passed = results.reduce((sum, tr) => sum + tr.passed, 0)
const failed = results.reduce((sum, tr) => sum + tr.failed, 0)
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0)
const shortSummary = `${passed} passed, ${failed} failed and ${skipped} skipped `
let baseUrl = '' let baseUrl = ''
if (this.useActionsSummary) { if (this.useActionsSummary) {
const summary = getReport(results, { const summary = getReport(results, {
@@ -182,6 +187,7 @@ class TestReporter {
core.info('Summary content:') core.info('Summary content:')
core.info(summary) core.info(summary)
core.summary.addRaw(`# ${shortSummary}`)
await core.summary.addRaw(summary).write() await core.summary.addRaw(summary).write()
} else { } else {
core.info(`Creating check run ${name}`) core.info(`Creating check run ${name}`)
@@ -214,11 +220,6 @@ class TestReporter {
const isFailed = this.failOnError && results.some(tr => tr.result === 'failed') const isFailed = this.failOnError && results.some(tr => tr.result === 'failed')
const conclusion = isFailed ? 'failure' : 'success' const conclusion = isFailed ? 'failure' : 'success'
const passed = results.reduce((sum, tr) => sum + tr.passed, 0)
const failed = results.reduce((sum, tr) => sum + tr.failed, 0)
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0)
const shortSummary = `${passed} passed, ${failed} failed and ${skipped} skipped `
core.info(`Updating check run conclusion (${conclusion}) and output`) core.info(`Updating check run conclusion (${conclusion}) and output`)
const resp = await this.octokit.rest.checks.update({ const resp = await this.octokit.rest.checks.update({
check_run_id: createResp.data.id, check_run_id: createResp.data.id,