@@ -42,14 +42,24 @@ def get_version_info() -> dict[str, str]:
4242 version = VERSION
4343 repo_url = REPOSITORY_URL .rstrip ("/" )
4444
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 ):
4847 parts = version .split ("-" )
4948 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 } "
5363 else :
5464 # Fallback to main branch
5565 version_link = f"{ repo_url } /tree/main"
0 commit comments