Reusable composite action that counts codebase tokens using tiktoken and generates a shields.io-style SVG badge. Color reflects context window usage: green (<30%), yellow-green (30-50%), yellow (50-70%), red (70%+). Badge includes hardcoded link back to repo-tokens. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
15 lines
870 B
XML
15 lines
870 B
XML
<svg xmlns="http://www.w3.org/2000/svg" width="97" height="20" role="img" aria-label="74.8k tokens">
|
|
<title>74.8k tokens</title>
|
|
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
|
<clipPath id="r"><rect width="97" height="20" rx="3"/></clipPath>
|
|
<g clip-path="url(#r)">
|
|
<rect width="52" height="20" fill="#555"/>
|
|
<rect x="52" width="45" height="20" fill="#97ca00"/>
|
|
<rect width="97" height="20" fill="url(#s)"/>
|
|
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
|
<text x="26" y="15" fill="#010101" fill-opacity=".3">tokens</text><text x="26" y="14">tokens</text>
|
|
<text x="74" y="15" fill="#010101" fill-opacity=".3">74.8k</text><text x="74" y="14">74.8k</text>
|
|
</g>
|
|
</g>
|
|
</svg>
|