File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,14 @@ export function getRepositoryInfo() {
2626 prNumber = pathParts [ prIndex + 1 ] ;
2727 }
2828
29+ // First try head-ref
30+ if ( ! prBranch ) {
31+ const branchSpan = document . querySelector ( 'span.head-ref' ) ;
32+ if ( branchSpan ) {
33+ prBranch = branchSpan . textContent . trim ( ) ;
34+ }
35+ }
36+
2937 // Try to find the branch name from the page using multiple selectors
3038 // First try the commit-ref selector (older GitHub UI)
3139 const branchElements = document . querySelectorAll ( '.commit-ref' ) ;
@@ -43,15 +51,7 @@ export function getRepositoryInfo() {
4351 prBranch = headRefElement . textContent . trim ( ) ;
4452 }
4553 }
46-
47- // If still not found, try another selector pattern
48- if ( ! prBranch ) {
49- const branchSpan = document . querySelector ( 'span.head-ref' ) ;
50- if ( branchSpan ) {
51- prBranch = branchSpan . textContent . trim ( ) ;
52- }
53- }
54-
54+
5555 // Clean up the branch name if it has any extra characters
5656 if ( prBranch ) {
5757 // Remove any emoji or special characters that might be in the branch name display
@@ -102,4 +102,4 @@ export function getPRForkInfo() {
102102 }
103103
104104 return null ;
105- }
105+ }
You can’t perform that action at this time.
0 commit comments