Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions checks/check_pr_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ def check_description(description):
Checks if the PR description contains a work item link.
Returns True if valid, False otherwise.
"""
regex = r"(^|\s)(https:\/\/app\.devrev\.ai\/devrev\/works\/)?(ISS|TKT|TASK)-\d+\b"
return bool(re.search(regex, description))
regex = r"(^|\s|\[)(https:\/\/app\.devrev\.ai\/devrev\/works\/)?(ISS|TKT|TASK)-\d+\b"
return bool(re.search(regex, description, re.IGNORECASE))

def check_description_cli(description):
"""
CLI version that prints messages and exits.
"""
print(f"Checking PR description: {description}")
if not check_description(description):
print("PR description must include a link to the work item (e.g., ISS-123, TKT-456, TASK-789, or a full https://app.devrev.ai/devrev/works/ISS-123 link).")
print("PR description must include a link to the work item (e.g., ISS-123, iss-123, TKT-456, tkt-456, TASK-789, task-789, or a full https://app.devrev.ai/devrev/works/ISS-123 link).")
print("Note: If using formats like 'work-item:ISS-123', make sure to add a space after the colon: 'work-item: ISS-123'")
sys.exit(1)
print("PR description contains a valid work item link.")
sys.exit(0)
Expand Down