@@ -42,14 +42,24 @@ def get_version_info() -> dict[str, str]:
42
42
version = VERSION
43
43
repo_url = REPOSITORY_URL .rstrip ("/" )
44
44
45
- # Check if version looks like a tag (doesn't contain branch-commit pattern)
46
- if version != "unknown" and "-" in version and len (version .split ("-" )) >= MIN_BRANCH_COMMIT_PARTS :
47
- # This looks like branch-commit format (e.g., "main-abc1234")
45
+ # Check if version contains PR number (e.g., "pr-123", "pull-456")
46
+ if version != "unknown" and ("-" in version ):
48
47
parts = version .split ("-" )
49
48
if len (parts ) >= MIN_BRANCH_COMMIT_PARTS :
50
- # Take the last part as commit hash
51
- commit_hash = parts [- 1 ]
52
- version_link = f"{ repo_url } /commit/{ commit_hash } "
49
+ # Check if first part indicates a PR
50
+ if parts [0 ].lower () in ("pr" , "pull" ):
51
+ # Extract PR number from the second part
52
+ try :
53
+ pr_number = int (parts [1 ])
54
+ version_link = f"{ repo_url } /pull/{ pr_number } "
55
+ except (ValueError , IndexError ):
56
+ # If PR number is invalid, fallback to main branch
57
+ version_link = f"{ repo_url } /tree/main"
58
+ else :
59
+ # This looks like branch-commit format (e.g., "main-abc1234")
60
+ # Take the last part as commit hash
61
+ commit_hash = parts [- 1 ]
62
+ version_link = f"{ repo_url } /commit/{ commit_hash } "
53
63
else :
54
64
# Fallback to main branch
55
65
version_link = f"{ repo_url } /tree/main"
0 commit comments