This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
GalacticFactory-Legacy/.forgejo/workflows/scripts/message.py
cswimr 1b8c30dd94
Some checks failed
Actions / Build Export Files (push) Successful in 7s
Actions / Autotagger (push) Failing after 10s
Actions / Build Documentation (push) Has been cancelled
rename .gitea directory to .forgejo
2024-10-21 14:03:17 -04:00

20 lines
526 B
Python

import re
import sys
from typing import Optional
pattern = r"^(?:V|v)ersion\ bump(?:ed)?\ to\ ([0-9]+\.[0-9]+\.[0-9]+(?:-[a-zA-Z0-9]+)?).*"
def get_commit_message(string) -> Optional[str]:
m = re.match(pattern, string)
if m:
return m.group(1)
else:
return None
if __name__ == "__main__":
if len(sys.argv) >= 2:
commit_message = sys.argv[1]
result = get_commit_message(commit_message)
print(result)
else:
print("Usage: python message.py <commit_message>")