Skip to content

Commit 2bdbc62

Browse files
committed
feat(crg): add crg-grade and crg-badge justfile recipes
1 parent edd0ed8 commit 2bdbc62

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Justfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,21 @@ help-me:
8989
@echo " https://github.com/hyperpolymath/sanctify-php/issues/new"
9090
@echo ""
9191
@echo "Include the output of 'just doctor' in your report."
92+
93+
94+
# Print the current CRG grade (reads from READINESS.md '**Current Grade:** X' line)
95+
crg-grade:
96+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
97+
[ -z "$$grade" ] && grade="X"; \
98+
echo "$$grade"
99+
100+
# Generate a shields.io badge markdown for the current CRG grade
101+
# Looks for '**Current Grade:** X' in READINESS.md; falls back to X
102+
crg-badge:
103+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
104+
[ -z "$$grade" ] && grade="X"; \
105+
case "$$grade" in \
106+
A) color="brightgreen" ;; B) color="green" ;; C) color="yellow" ;; \
107+
D) color="orange" ;; E) color="red" ;; F) color="critical" ;; \
108+
*) color="lightgrey" ;; esac; \
109+
echo "[![CRG $$grade](https://img.shields.io/badge/CRG-$$grade-$$color?style=flat-square)](https://github.com/hyperpolymath/standards/tree/main/component-readiness-grades)"

0 commit comments

Comments
 (0)