diff options
author | 2023-05-11 05:28:40 +0800 | |
---|---|---|
committer | 2023-05-10 21:28:40 +0000 | |
commit | 48658675d7bbb3ecd5e3a51df0447b65bb0b1219 (patch) | |
tree | d70832506df4326c612f721b1c6c496513db0eac /source/github-helpers/get-default-branch.ts | |
parent | 358edc207f72fb01a32c916c28b90839359c662a (diff) | |
download | refined-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.ts | 5 |
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> { |