From 14f1a7b27a8f19e67fd3a97b55f1f9ef15bbae97 Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Sun, 28 Jun 2020 17:47:44 +0200 Subject: [PATCH] Positive req/seq change is not a warning (#14640) Tweak PR stats message for req/sec metrics. I think they should warn when they are negative, not when positive --- .github/actions/next-stats-action/src/add-comment.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/actions/next-stats-action/src/add-comment.js b/.github/actions/next-stats-action/src/add-comment.js index 7458f1b422..e483ffcfe6 100644 --- a/.github/actions/next-stats-action/src/add-comment.js +++ b/.github/actions/next-stats-action/src/add-comment.js @@ -101,7 +101,15 @@ module.exports = async function addComment( // check if there is still a change after rounding if (change !== 0) { const absChange = Math.abs(change) - change = `${change < 0 ? '-' : '⚠️ +'}${ + const warnIfNegative = isBenchmark && itemKey.match(/req\/sec/) + const warn = warnIfNegative + ? change < 0 + ? '⚠️ ' + : '' + : change > 0 + ? '⚠️ ' + : '' + change = `${warn}${change < 0 ? '-' : '+'}${ useRawValue ? absChange : prettify(absChange, prettyType) }` } -- GitLab