Add new PR automation

This commit is contained in:
bbhtt
2025-05-25 11:59:33 +05:30
parent 7c17cdc50c
commit 6eb7d8daba
2 changed files with 140 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import re
import os
def validate_title(title: str) -> int:
if not title.startswith("Add "):
return 42
appid = title[len("Add ") :].strip()
regex = r"^[A-Za-z_][\w\-]*$"
split = appid.split(".")
if (
len(split) > 255
or len(split) < 3
or not all(re.match(regex, sp) for sp in split)
):
return 42
return 0
if __name__ == "__main__":
title = os.environ["PR_TITLE"]
exit_code = validate_title(title)
print(f"EXIT_CODE={exit_code}")
exit(0)