Skip to content

Commit a63ae11

Browse files
committed
fix: use GraphQL query param for branch prefix search instead of refPrefix
1 parent 98e2e9b commit a63ae11

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/VCS/Adapter/Git/GitHub.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -793,11 +793,12 @@ public function listBranches(string $owner, string $repositoryName, int $perPage
793793
*/
794794
private function listBranchesPage(string $owner, string $repositoryName, int $perPage, ?string $cursor, string $search): array
795795
{
796-
$refPrefix = 'refs/heads/' . $search;
796+
// refPrefix must be a complete path namespace (e.g. "refs/heads/"); the separate
797+
// query param handles prefix filtering on branch names.
797798
$query = <<<'GRAPHQL'
798-
query ListBranches($owner: String!, $name: String!, $refPrefix: String!, $first: Int!, $after: String) {
799+
query ListBranches($owner: String!, $name: String!, $first: Int!, $after: String, $query: String) {
799800
repository(owner: $owner, name: $name) {
800-
refs(refPrefix: $refPrefix, first: $first, after: $after, orderBy: {field: ALPHABETICAL, direction: ASC}) {
801+
refs(refPrefix: "refs/heads/", first: $first, after: $after, orderBy: {field: ALPHABETICAL, direction: ASC}, query: $query) {
801802
nodes {
802803
name
803804
}
@@ -815,9 +816,9 @@ private function listBranchesPage(string $owner, string $repositoryName, int $pe
815816
'variables' => [
816817
'owner' => $owner,
817818
'name' => $repositoryName,
818-
'refPrefix' => $refPrefix,
819819
'first' => $perPage,
820820
'after' => $cursor,
821+
'query' => $search !== '' ? $search : null,
821822
],
822823
]);
823824

0 commit comments

Comments
 (0)