feat: differentiate between commit and html-formatted commit

This commit is contained in:
2025-04-16 12:07:04 +02:00
parent c35da4a043
commit 5f13949cd4
4 changed files with 14 additions and 8 deletions

View File

@@ -1,10 +1,16 @@
from git import Repo # hash ostatniego commitu
def getCommit():
repo = "<p>Brak informacji o wersji skryptu</p>"
try:
repo = Repo(search_parent_directories=True).head.object.hexsha
repo = f"<p>Commit: <a href='https://gitea.7o7.cx/roberteam/lewangoalski/commit/{repo}'>{repo[:11]}</a></p>"
return Repo(search_parent_directories=True).head.object.hexsha
except:
pass
return None
def getCommitInFormattedHTML():
repo = "<p>Brak informacji o wersji skryptu</p>"
commit = getCommit()
if commit is not None:
repo = f"<p>Commit: <a href='https://gitea.7o7.cx/roberteam/lewangoalski/commit/{commit}'>{commit[:11]}</a></p>"
return repo