Skip to content
Draft
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
8 changes: 5 additions & 3 deletions source/github-helpers/pr-branches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
function parseReference(referenceElement: HTMLElement): PrReference {
const {title, textContent, nextElementSibling} = referenceElement;

// In the old React version, we have a `title` attribute but it's used to mark deleted repos instead
// In the React version, we have a `title` attribute but it's used to mark deleted repos instead
return title && title !== 'This repository has been deleted'
? parseReferenceRaw(title, textContent.trim()) // TODO: Remove in June 2026
: parseReferenceRaw(nextElementSibling!.textContent.trim(), textContent.trim());
Expand All @@ -64,17 +64,19 @@
return {
get base() {
return parseReference($([
'span[class*="PullRequestHeaderSummary"] > a[class^="PullRequestBranchName"]',
'span[class*="PullRequestHeaderSummary"] > [class^="PullRequestBranchName"]',
'[class*="PullRequestHeaderSummary"] > [class*="PullRequestHeaderSummary"]', // TODO: Remove after July 2026
'.base-ref', // TODO: Remove in June 2026
]));
},
get head() {
return parseReference($([
'span[class*="PullRequestHeaderSummary"] > div > a[class^="PullRequestBranchName"]',
'span[class*="PullRequestHeaderSummary"] > div > [class^="PullRequestBranchName"]',
'[class*="PullRequestHeaderSummary"] * [class*="PullRequestHeaderSummary"]', // TODO: Remove after July 2026
'.head-ref', // TODO: Remove in June 2026
]));
},
};
}

window.getBranches = getBranches;

Check failure on line 82 in source/github-helpers/pr-branches.ts

View workflow job for this annotation

GitHub Actions / Vitest

source/github-helpers/pr-branches.test.ts

ReferenceError: window is not defined ❯ source/github-helpers/pr-branches.ts:82:1 ❯ source/github-helpers/pr-branches.test.ts:3:1

Check failure on line 82 in source/github-helpers/pr-branches.ts

View workflow job for this annotation

GitHub Actions / Lint

Prefer `globalThis` over `window`

Check failure on line 82 in source/github-helpers/pr-branches.ts

View workflow job for this annotation

GitHub Actions / Types

Property 'getBranches' does not exist on type 'Window & typeof globalThis'.
Loading