mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 11:50:37 +08:00
fix: handle missing issue body and improve error logging in ticket compliance check
This commit is contained in:
@ -32,7 +32,8 @@ def extract_ticket_links_from_pr_description(pr_description, repo_path):
|
|||||||
"""
|
"""
|
||||||
Extract all ticket links from PR description
|
Extract all ticket links from PR description
|
||||||
"""
|
"""
|
||||||
|
github_tickets = []
|
||||||
|
try:
|
||||||
# example link to search for: https://github.com/Codium-ai/pr-agent-pro/issues/525
|
# example link to search for: https://github.com/Codium-ai/pr-agent-pro/issues/525
|
||||||
pattern = r'https://github[^/]+/[^/]+/[^/]+/issues/\d+' # should support also github server (for example 'https://github.company.ai/Codium-ai/pr-agent-pro/issues/525')
|
pattern = r'https://github[^/]+/[^/]+/[^/]+/issues/\d+' # should support also github server (for example 'https://github.company.ai/Codium-ai/pr-agent-pro/issues/525')
|
||||||
|
|
||||||
@ -47,6 +48,9 @@ def extract_ticket_links_from_pr_description(pr_description, repo_path):
|
|||||||
# check if issue_number is a valid number and len(issue_number) < 5
|
# check if issue_number is a valid number and len(issue_number) < 5
|
||||||
if issue_number.isdigit() and len(issue_number) < 5:
|
if issue_number.isdigit() and len(issue_number) < 5:
|
||||||
github_tickets.append(f'https://github.com/{repo_path}/issues/{issue_number}')
|
github_tickets.append(f'https://github.com/{repo_path}/issues/{issue_number}')
|
||||||
|
except Exception as e:
|
||||||
|
get_logger().error(f"Error extracting tickets error= {e}",
|
||||||
|
artifact={"traceback": traceback.format_exc()})
|
||||||
|
|
||||||
return github_tickets
|
return github_tickets
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user