This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 744aed955 chore(ci): cleaner badge calculation
744aed955 is described below

commit 744aed95548063c8985f31df4c089d3b6dd22cff
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Mon Feb 9 16:01:28 2026 +0100

    chore(ci): cleaner badge calculation
---
 .github/actions/automatic-updates/action.yml | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/.github/actions/automatic-updates/action.yml 
b/.github/actions/automatic-updates/action.yml
index 09537fbf0..0e19255f2 100644
--- a/.github/actions/automatic-updates/action.yml
+++ b/.github/actions/automatic-updates/action.yml
@@ -67,17 +67,24 @@ runs:
           | grep -v "github.com/apache/camel-k/v2/cmd/util"  > coverage.mod.out
         go tool cover -func=coverage.mod.out -o=coverage.mod.out
         grep -o -P '(?<=\(statements\))(.+)(?=%)' coverage.mod.out | xargs > 
coverage
-        touch badge.out
-        curl -sf 
https://gobinaries.com/github.com/AlexBeauchemin/[email protected] | PREFIX=. sh
-        chmod +x gobadge
-        ./gobadge -filename=coverage -target=badge.out
 
-    - name: Convert badge to adoc
+    - name: Convert coverage to adoc
       shell: bash
       run: |
-        replacement=$(grep -o 'https://[^)]*' badge.out)
-        target="(?:https:\/\/img\.shields\.io\/badge\/Coverage).*?(?=\.svg)"
-        perl -i -pe "s|${target}|${replacement}|g" README.adoc
+        COVERAGE=$(cat coverage)
+        COVERAGE_INT=${COVERAGE%.*}
+
+        if [ "$COVERAGE_INT" -lt 40 ]; then
+          COLOR="red"
+        elif [ "$COVERAGE_INT" -lt 70 ]; then
+          COLOR="yellow"
+        else
+          COLOR="green"
+        fi
+
+        sed -i \
+          
"s|https://img.shields.io/badge/Coverage-.*\.svg|https://img.shields.io/badge/Coverage-${COVERAGE}-${COLOR}.svg|g"
 \
+          README.md
 
     # Git push
     - name: Push changes

Reply via email to