summaryrefslogtreecommitdiff
path: root/source/github-helpers/get-default-branch.ts
diff options
context:
space:
mode:
authorGravatar Federico Brigante <me@fregante.com> 2023-05-11 05:28:40 +0800
committerGravatar GitHub <noreply@github.com> 2023-05-10 21:28:40 +0000
commit48658675d7bbb3ecd5e3a51df0447b65bb0b1219 (patch)
treed70832506df4326c612f721b1c6c496513db0eac /source/github-helpers/get-default-branch.ts
parent358edc207f72fb01a32c916c28b90839359c662a (diff)
downloadrefined-github-23.5.10.tar.gz
refined-github-23.5.10.tar.zst
refined-github-23.5.10.zip
Improve reliability of `list-prs-for-branch` (#6641)23.5.10
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> {