From 39b03e6cd34d0e3c52cc35a9165b3bd891e525ad Mon Sep 17 00:00:00 2001 From: Bertrand Marron Date: Sat, 4 Aug 2018 16:54:13 +0200 Subject: [PATCH] live-fns: set colors for all circleci statuses (#73) --- libs/live-fns/circleci.js | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/libs/live-fns/circleci.js b/libs/live-fns/circleci.js index d623289..e17986d 100644 --- a/libs/live-fns/circleci.js +++ b/libs/live-fns/circleci.js @@ -10,6 +10,36 @@ module.exports = async function (vcsType, username, project, branch) { return { subject: 'circleci', status: latest.status.replace(/_/g, ' '), - color: latest.status === 'success' ? 'green' : 'red' + color: getStatusColor(latest.status) + } +} + +function getStatusColor (status) { + switch (status) { + case 'infrastructure_fail': + case 'timedout': + case 'failed': + case 'no_tests': + return 'red' + + case 'canceled': + case 'not_run': + case 'not_running': + return 'grey' + + case 'queued': + case 'scheduled': + return 'yellow' + + case 'retried': + case 'running': + return 'blue' + + case 'fixed': + case 'success': + return 'green' + + default: + return 'grey' } }