Skip to content

Commit 75d0a95

Browse files
andimarekclaude
andcommitted
Add green/red color indicators to test and coverage deltas
Test results: green for more total/passed, red for more failed/errors. Coverage deltas: green for increase, red for decrease. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2432bc6 commit 75d0a95

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

.github/workflows/pull_request.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,17 @@ jobs:
179179
}
180180
181181
// --- Helpers ---
182-
function delta(curr, prev) {
182+
function delta(curr, prev, positiveIsGood) {
183183
const d = curr - prev;
184184
if (d === 0) return '±0';
185-
return d > 0 ? `+${d}` : `${d}`;
185+
const str = d > 0 ? `+${d}` : `${d}`;
186+
if (positiveIsGood === undefined) return str;
187+
const icon = (positiveIsGood ? d > 0 : d < 0) ? ' 🟢' : ' 🔴';
188+
return str + icon;
186189
}
187190
188-
function fmtCell(curr, prev) {
189-
return `${curr} (${delta(curr, prev)})`;
191+
function fmtCell(curr, prev, positiveIsGood) {
192+
return `${curr} (${delta(curr, prev, positiveIsGood)})`;
190193
}
191194
192195
function pct(covered, missed) {
@@ -201,7 +204,9 @@ jobs:
201204
function fmtPctDelta(curr, prev) {
202205
const d = curr - prev;
203206
if (Math.abs(d) < 0.05) return '±0.0%';
204-
return d > 0 ? `+${d.toFixed(1)}%` : `${d.toFixed(1)}%`;
207+
const str = d > 0 ? `+${d.toFixed(1)}%` : `${d.toFixed(1)}%`;
208+
const icon = d > 0 ? ' 🟢' : ' 🔴';
209+
return str + icon;
205210
}
206211
207212
// --- Build Test Results table ---
@@ -217,7 +222,7 @@ jobs:
217222
if (!current[v]) {
218223
body += `| ${label} | - | - | - | - | - |\n`;
219224
} else {
220-
body += `| ${label} | ${fmtCell(c.total, b.total)} | ${fmtCell(c.passed, b.passed)} | ${fmtCell(c.failed, b.failed)} | ${fmtCell(c.errors, b.errors)} | ${fmtCell(c.skipped, b.skipped)} |\n`;
225+
body += `| ${label} | ${fmtCell(c.total, b.total, true)} | ${fmtCell(c.passed, b.passed, true)} | ${fmtCell(c.failed, b.failed, false)} | ${fmtCell(c.errors, b.errors, false)} | ${fmtCell(c.skipped, b.skipped)} |\n`;
221226
}
222227
}
223228
@@ -235,7 +240,7 @@ jobs:
235240
}
236241
}
237242
if (hasAny) {
238-
body += `| **Total** | **${fmtCell(totalCurr.total, totalBase.total)}** | **${fmtCell(totalCurr.passed, totalBase.passed)}** | **${fmtCell(totalCurr.failed, totalBase.failed)}** | **${fmtCell(totalCurr.errors, totalBase.errors)}** | **${fmtCell(totalCurr.skipped, totalBase.skipped)}** |\n`;
243+
body += `| **Total** | **${fmtCell(totalCurr.total, totalBase.total, true)}** | **${fmtCell(totalCurr.passed, totalBase.passed, true)}** | **${fmtCell(totalCurr.failed, totalBase.failed, false)}** | **${fmtCell(totalCurr.errors, totalBase.errors, false)}** | **${fmtCell(totalCurr.skipped, totalBase.skipped)}** |\n`;
239244
}
240245
241246
// --- Build Coverage table ---

0 commit comments

Comments
 (0)