Skip to content

feat: add trend indicators to PR comments and CI summary#28

Merged
maximn merged 2 commits into
mainfrom
feat/trend-indicators-in-pr-comments
Apr 4, 2026
Merged

feat: add trend indicators to PR comments and CI summary#28
maximn merged 2 commits into
mainfrom
feat/trend-indicators-in-pr-comments

Conversation

@maximn
Copy link
Copy Markdown
Contributor

@maximn maximn commented Apr 4, 2026

Summary

Adds at-a-glance trend indicators to PR comments and CI summaries using cached history. When 3+ runs exist, trend arrows (↑ → ↓) and deltas appear for pass rate, duration, and test count. When 5+ runs exist, ASCII sparklines are also shown.

Changes

  • src/history/types.ts — added TrendDirection type and TrendIndicators interface
  • src/history/trends.ts (new) — computeTrends() function + shared buildSparkline() helper
  • src/history/perf-regression.ts — refactored buildDurationSparkline() to use shared buildSparkline()
  • src/output/pr-comment.ts — added renderTrendLine(), wired into renderTestJobSection() below stats line
  • src/output/summary.ts — added renderTrendsSection(), inserted after metrics table in generateSummary()
  • src/index.ts — compute trends when ≥3 entries, non-blocking try/catch, pass to summary + PR comment
  • Tests — 41 new tests across unit, rendering, and integration layers (553 total, zero regressions)

PR comment format:

📈 Pass rate: 97.5% ↑ (+2.3%) · Duration: 12.4s ↓ (-1.2s, -8.8%) · Tests: 100 (+3)

CI summary format (with sparklines):

### Trends
**Pass rate:** ▃▅▅▆▇ 97.5% ↑ (+2.3%)
**Duration:** ▅▃▃▂▁ 12.4s ↓ (-1.2s)
**Tests:** 100 (+3)

Test plan

  • Verify PR comment shows trend line when history has ≥3 runs
  • Verify CI summary shows Trends section with arrows and deltas
  • Verify sparklines appear only when ≥5 runs
  • Verify trends are omitted entirely when history: false
  • Verify trends are omitted when fewer than 3 runs exist
  • Confirm action does not fail when trend computation throws

maximn added 2 commits April 4, 2026 22:59
Computes pass rate direction/delta, duration direction/delta, and test
count delta from history (>=3 runs). Extracts shared buildSparkline()
from perf-regression.ts; sparklines shown when >=5 runs.

PR comments: trend line below stats showing arrows + deltas.
CI summary: Trends section with sparklines, arrows, and deltas.
All errors non-blocking via core.debug().
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

@maximn maximn merged commit f3324dc into main Apr 4, 2026
6 checks passed
@maximn maximn deleted the feat/trend-indicators-in-pr-comments branch April 4, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant