diff --git a/.github/scripts/label-pull-request.mjs b/.github/scripts/label-pull-request.mjs index 22041164d..64ffbddb9 100644 --- a/.github/scripts/label-pull-request.mjs +++ b/.github/scripts/label-pull-request.mjs @@ -99,7 +99,7 @@ function normalizeChangedFiles(changedFiles) { function conventionalType(title) { const normalized = String(title || "").trim().replace(/^[^\p{L}\p{N}]+/u, ""); - return /^([a-z]+)(?:\([^)]*\))?!?:/i.exec(normalized)?.[1]?.toLowerCase() || null; + return /^([a-z]+)(?:\([^)]*\))?!?[::]/i.exec(normalized)?.[1]?.toLowerCase() || null; } export function isDocumentationFile(file) { diff --git a/.github/scripts/label-pull-request.test.mjs b/.github/scripts/label-pull-request.test.mjs index da63ac3d0..eb40362d4 100644 --- a/.github/scripts/label-pull-request.test.mjs +++ b/.github/scripts/label-pull-request.test.mjs @@ -88,6 +88,16 @@ test("does not treat component tests or MCP server code as UI or deploy changes" assert.deepEqual(result.labels, ["area/desktop", "area/mcp", "bug"]); }); +test("recognizes conventional titles with a full-width colon", () => { + const result = evaluatePullRequestLabels({ + title: "Fix:补全 GaussDB M 模式 SQL 生成", + changedFiles: ["crates/dbx-core/src/db/mod.rs"], + knownDatabaseTypes, + }); + + assert.deepEqual(result.labels, ["area/core", "bug"]); +}); + test("detects only newly added package dependencies", () => { const result = inferAddedDependencies( ["package.json"],