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
SeaswimmerTheFsh a902fb01eb
Some checks failed
Autotagger / Autotagger (push) Failing after 3s
Build / Documentation (push) Successful in 13s
Build / Export Files (push) Successful in 4s
using python for some conditional stuff instead of bash
2024-03-11 21:32:35 -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>")