Skip to content

Commit 65d1da1

Browse files
committed
fix diff formatting
1 parent d52e984 commit 65d1da1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ci/check_lines.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function printMarkdownTable(data: any[]) {
2828
const keys = Object.keys(data[0])
2929
const alignments = keys.map((key) => (typeof data[0][key] === 'number' ? '---:' : ':---'))
3030
console.log(`| ${keys.join(' | ')} |\n| ${alignments.join(' | ')} |`)
31-
console.log(data.map((row) => `| ${keys.map((key) => row[key]).join(' | ')} |`).join('\n'))
31+
console.log(data.map((row) => `| ${keys.map((key) => (key === 'diff' ? formatDiff(row[key]) : row[key])).join(' | ')} |`).join('\n'))
3232
}
3333

3434
const formatDiff = (count: number) => (count > 0 ? `+${count}` : count.toString())
@@ -67,7 +67,7 @@ if (import.meta.main) {
6767
diff.sort((a, b) => b.diff - a.diff)
6868

6969
console.log('## Changes:')
70-
printMarkdownTable(diff.map((row) => ({ ...row, diff: formatDiff(row.diff) })))
70+
printMarkdownTable(diff)
7171

7272
const totalDiff = diff.reduce((sum, file) => sum + file.diff, 0)
7373
const total = prStats.reduce((sum, file) => sum + file.lines, 0)

0 commit comments

Comments
 (0)