fix(github): recognize full-width PR title colons

This commit is contained in:
t8y2 2026-07-31 13:00:30 +08:00
parent a71104be5f
commit da53d207db
No known key found for this signature in database
2 changed files with 11 additions and 1 deletions

View File

@ -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) {

View File

@ -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"],