EMXArms/.forgejo/workflows/scripts/message.py
Seaswimmer fa43c8835f
All checks were successful
Actions / Autotagger (push) Successful in 8s
Actions / Build Gunpack (push) Successful in 17s
moved message.py to the correct directory
2024-07-23 17:41:04 -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>")