4
4
Issue ,
5
5
PluginReport ,
6
6
} from '@code-pushup/models' ;
7
+ import { CommitData } from './git' ;
7
8
import {
8
9
NEW_LINE ,
9
10
details ,
@@ -36,7 +37,10 @@ import {
36
37
reportOverviewTableHeaders ,
37
38
} from './utils' ;
38
39
39
- export function reportToMd ( report : ScoredReport ) : string {
40
+ export function reportToMd (
41
+ report : ScoredReport ,
42
+ commitData : CommitData | null ,
43
+ ) : string {
40
44
// header section
41
45
let md = reportToHeaderSection ( ) + NEW_LINE ;
42
46
@@ -50,7 +54,7 @@ export function reportToMd(report: ScoredReport): string {
50
54
md += reportToAuditsSection ( report ) + NEW_LINE + NEW_LINE ;
51
55
52
56
// about section
53
- md += reportToAboutSection ( report ) + NEW_LINE + NEW_LINE ;
57
+ md += reportToAboutSection ( report , commitData ) + NEW_LINE + NEW_LINE ;
54
58
55
59
// footer section
56
60
md += `${ FOOTER_PREFIX } ${ link ( README_LINK , 'Code PushUp' ) } ` ;
@@ -248,16 +252,19 @@ function reportToAuditsSection(report: ScoredReport): string {
248
252
return h2 ( '🛡️ Audits' ) + NEW_LINE + NEW_LINE + auditsData ;
249
253
}
250
254
251
- function reportToAboutSection ( report : ScoredReport ) : string {
255
+ function reportToAboutSection (
256
+ report : ScoredReport ,
257
+ commitData : CommitData | null ,
258
+ ) : string {
252
259
const date = new Date ( ) . toString ( ) ;
253
260
const { duration, version, plugins, categories } = report ;
254
- // TODO: replace mock commitData with real data, ticket #192
255
- const commitData =
256
- '_Implement todos list_ ([3ac01d1](https://github.com/flowup/todos-app/commit/3ac01d192698e0a923bd410f79594371480a6e4c)) ';
261
+ const commitInfo = commitData
262
+ ? ` ${ commitData . message } ( ${ commitData . hash . slice ( 0 , 7 ) } )`
263
+ : 'N/A ';
257
264
const reportMetaTable : string [ ] [ ] = [
258
265
reportMetaTableHeaders ,
259
266
[
260
- commitData ,
267
+ commitInfo ,
261
268
style ( version || '' , [ 'c' ] ) ,
262
269
formatDuration ( duration ) ,
263
270
plugins . length . toString ( ) ,
0 commit comments