Skip to content

Commit b935cc2

Browse files
committed
allow use of latest tag in minimum-version of docs/actions.yml
1 parent 709c995 commit b935cc2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/badge_hook.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A mkdocs hook that injects an HTML syntax used to generate badges at build time."""
2+
23
import re
34
from re import Match
45
from mkdocs.config.defaults import MkDocsConfig
@@ -30,11 +31,13 @@ def replace(match: Match):
3031
# -----------------------------------------------------------------------------
3132
# Helper functions
3233

34+
3335
def _badge_for_flags(arg, page: Page, files: Files):
3436
if arg == "experimental":
3537
return _badge_for_experimental(page, files)
3638
raise ValueError(f"Unsupported badge flag: {arg}")
3739

40+
3841
# Create badge
3942
def _badge(icon: str, text: str = ""):
4043
return "".join(
@@ -50,10 +53,12 @@ def _badge(icon: str, text: str = ""):
5053
# Create badge for version
5154
def _badge_for_version(text: str, page: Page, files: Files):
5255
icon = "material-tag-outline"
53-
href = f"https://github.com/cpp-linter/cpp-linter-action/releases/v{text}"
56+
href = "https://github.com/cpp-linter/cpp-linter-action/releases/" + (
57+
f"v{text}" if text[0:1].isdigit() else text
58+
)
5459
return _badge(
55-
icon=f'[:{icon}:]({href} "required version")',
56-
text=f'[{text}]({href} "required version")',
60+
icon=f'[:{icon}:]({href} "minimum version")',
61+
text=f'[{text}]({href} "minimum version")',
5762
)
5863

5964

0 commit comments

Comments
 (0)