From 1446720355e93c1e88779e69fa6e1e35ef8b4d9c Mon Sep 17 00:00:00 2001 From: Austin Anderson <angerson@google.com> Date: Tue, 9 May 2023 13:53:34 -0700 Subject: [PATCH] Tweak badge generation --- tf_oss_dashboard/dashboard.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tf_oss_dashboard/dashboard.py b/tf_oss_dashboard/dashboard.py index c69e50c..57a907d 100755 --- a/tf_oss_dashboard/dashboard.py +++ b/tf_oss_dashboard/dashboard.py @@ -239,9 +239,10 @@ print(template.render( # Maybe the print statement above should be using an output file instead. for category in YAML_CONFIG["badges"]: total = len(by_group[category]) - failing = total - sum([jobs[0]["passing"] for name, jobs in by_group[category].items()]) + passed = sum([jobs[0]["passing"] for name, jobs in by_group[category].items()]) + failed = total - passed if failing == 0: - url = f"https://img.shields.io/static/v1?label={category}&message=passing&color=success" + url = f"https://img.shields.io/static/v1?label={category}&message={passed} passed, 0 failed&color=success" else: - url = f"https://img.shields.io/static/v1?label={category}&message={failing}/{total} failing&color=critical" + url = f"https://img.shields.io/static/v1?label={category}&message={passed} passed, {failed} failed&color=critical" subprocess.run(["wget", url, "-O", f"{category}.svg"]) -- GitLab