summaryrefslogtreecommitdiff
path: root/source/github-helpers/get-default-branch.ts
diff options
context:
space:
mode:
Diffstat (limited to 'source/github-helpers/get-default-branch.ts')
-rw-r--r--source/github-helpers/get-default-branch.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/source/github-helpers/get-default-branch.ts b/source/github-helpers/get-default-branch.ts
index ffb87e23..85a61040 100644
--- a/source/github-helpers/get-default-branch.ts
+++ b/source/github-helpers/get-default-branch.ts
@@ -3,7 +3,7 @@ import elementReady from 'element-ready';
import {type RepositoryInfo} from 'github-url-detection';
import * as api from './api.js';
-import {getRepo} from './index.js';
+import {extractCurrentBranchFromBranchPicker, getRepo} from './index.js';
import {branchSelector} from './selectors.js';
const isCurrentRepo = ({nameWithOwner}: RepositoryInfo): boolean => Boolean(getRepo()?.nameWithOwner === nameWithOwner);
@@ -17,8 +17,7 @@ async function fromDOM(): Promise<string | undefined> {
// We're on the default branch, so we can extract it from the current page. This exclusively happens on the exact pages:
// /user/repo
// /user/repo/commits (without further path)
- const branchPicker = await elementReady(branchSelector);
- return branchPicker!.textContent!.trim();
+ return extractCurrentBranchFromBranchPicker((await elementReady(branchSelector))!);
}
async function fromAPI(repository: RepositoryInfo): Promise<string> {