Skip to content

Commit 6bacf42

Browse files
fix(gitlab): leave labels named None or Any to the service
GitLab reads None and Any in labels and not[labels] as unlabeled and labeled, so excluding a label named Any dropped every labeled merge request. Those names are narrowed by the service instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f4b7030 commit 6bacf42

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ layer("GitLabPullRequestCli.layer", (it) => {
159159
viewer: "bilal",
160160
limit: 10,
161161
filters: {
162-
labels: [["bug"], ["size:S", "size:XS"], ["a,b"]],
163-
excludedLabels: ["wontfix", "stale"],
162+
labels: [["bug"], ["size:S", "size:XS"], ["a,b"], ["None"]],
163+
excludedLabels: ["wontfix", "stale", "any"],
164164
author: "@me",
165165
draft: "only",
166166
},

‎packages/source-control-gitlab/src/server/GitLabPullRequestCli.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ function involvementParams(input: {
423423

424424
/**
425425
* GitLab's `labels` asks for every label it names, so only groups of one go to it; a group of
426-
* alternatives is left for the service to narrow. A comma would split a name in two.
426+
* alternatives is left for the service to narrow. A comma would split a name in two, and `None`
427+
* and `Any` mean "unlabeled" and "labeled" to GitLab rather than labels of those names.
427428
*/
428429
function filterParams(input: {
429430
readonly filters?: PullRequestListFilters | undefined;
@@ -432,7 +433,8 @@ function filterParams(input: {
432433
}): ReadonlyArray<readonly [string, string]> {
433434
const filters = input.filters;
434435
if (filters === undefined) return [];
435-
const listable = (names: ReadonlyArray<string>) => names.filter((name) => !name.includes(","));
436+
const listable = (names: ReadonlyArray<string>) =>
437+
names.filter((name) => !name.includes(",") && !/^(?:none|any)$/iu.test(name.trim()));
436438
const required = listable(
437439
(filters.labels ?? []).flatMap((group) => (group.length === 1 ? group : [])),
438440
);

0 commit comments

Comments
 (0)