Skip to content

Commit 14a0f98

Browse files
committed
add footer msg
1 parent a7b1fd4 commit 14a0f98

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ctrf/handle-baseline.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ export function handleBaseline(
6868
source: baselineReport.results?.environment?.buildUrl ?? '',
6969
commit: baselineReport.results?.environment?.commit ?? '',
7070
buildName: baselineReport.results?.environment?.buildName ?? '',
71-
buildNumber: baselineReport.results?.environment?.buildNumber ?? undefined,
71+
buildNumber:
72+
baselineReport.results?.environment?.buildNumber ?? undefined,
7273
buildUrl: baselineReport.results?.environment?.buildUrl ?? '',
7374
extra: {
7475
buildId: baselineReport.results?.environment?.buildId ?? ''

src/github/core.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { COMMUNITY_REPORTS_PATH } from '../config'
99
import { DEFAULT_REPORT_ORDER } from '../reports/constants'
1010
import { join } from 'path'
1111
import { isAnyReportEnabled } from '../utils/report-utils'
12+
import { context } from '@actions/github'
1213

1314
/**
1415
* Generates various views of the CTRF report and adds them to the GitHub Actions summary.
@@ -143,6 +144,16 @@ function addReportFooters(
143144
?.reportConditionals as ReportConditionals
144145
const footerMessages: string[] = []
145146

147+
if (report.baseline && hasPreviousResultsReports) {
148+
let comparisonText = `Comparison with baseline: `
149+
if (report.baseline.commit) {
150+
const commitSha = report.baseline.commit.substring(0, 7)
151+
const commitUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/commit/${report.baseline.commit}`
152+
comparisonText += `[${commitSha}](${commitUrl})`
153+
}
154+
footerMessages.push(comparisonText)
155+
}
156+
146157
if (reportConditionals.includeFailedReportCurrentFooter) {
147158
footerMessages.push(`🎉 No failed tests in this run.`)
148159
}

0 commit comments

Comments
 (0)