checkReportJson function
Machine-readable verdicts of one run's checks, keyed for consumers (the
action's PR-comment step renders the regressions rows).
Implementation
String checkReportJson(List<MetricCheck> rows) {
final regressions = rows.where((r) => r.regression).toList();
return jsonEncode({
'ok': regressions.isEmpty,
'regressions': regressions.length,
'metrics': [
for (final r in rows)
{
'metric': r.metric,
'ref': r.ref,
'measured': r.measured,
if (r.golden != null) 'golden': r.golden,
'status': r.regression
? 'regression'
: (r.noGolden ? 'no-golden' : 'ok'),
if (r.deltaPct != null) 'deltaPct': r.deltaPct,
},
],
});
}