Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(github): preserve zero-valued task numbers

Tin4f370aaca4eb
diff --git a/apps/api/src/plugins/github/utils/branch-matcher.ts b/apps/api/src/plugins/github/utils/branch-matcher.ts
index 69cdeccc0..9412b86df 100644
--- a/apps/api/src/plugins/github/utils/branch-matcher.ts
+++ b/apps/api/src/plugins/github/utils/branch-matcher.ts
@@ -117,16 +117,16 @@ export function extractTaskNumber(
config,
projectSlug,
);
- if (fromBranch) return fromBranch;
+ if (fromBranch !== null) return fromBranch;
if (prTitle) {
const fromTitle = extractTaskNumberFromPRTitle(prTitle);
- if (fromTitle) return fromTitle;
+ if (fromTitle !== null) return fromTitle;
}
if (prBody) {
const fromBody = extractTaskNumberFromPRBody(prBody);
- if (fromBody) return fromBody;
+ if (fromBody !== null) return fromBody;
}
return null;
diff --git a/tests/api/plugins/github/utils/branch-matcher.test.ts b/tests/api/plugins/github/utils/branch-matcher.test.ts
index 3123c3dfe..ca8d8b6fd 100644
--- a/tests/api/plugins/github/utils/branch-matcher.test.ts
+++ b/tests/api/plugins/github/utils/branch-matcher.test.ts
@@ -132,4 +132,16 @@ describe("extractTaskNumber", () => {
),
).toBe(21);
});
+
+ it("accepts task number 0 from the branch before other matches", () => {
+ expect(
+ extractTaskNumber(
+ "kan-0-initial-setup",
+ "[99] Other task",
+ undefined,
+ baseConfig,
+ "KAN",
+ ),
+ ).toBe(0);
+ });
});