From 87baf753016132c4fcf8e1166fa9c085de78a206 Mon Sep 17 00:00:00 2001 From: Andy Lee Date: Mon, 20 Jul 2026 15:23:26 +0800 Subject: [PATCH] fix(ci): support scoped commit prefixes in PR label extraction (#1032) Strip the scope in parentheses so titles like 'refactor(host): ...' resolve to the 'refactor' type instead of falling back to 'other'. Signed-off-by: Andy Lee --- scripts/extract-release-label.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/extract-release-label.mjs b/scripts/extract-release-label.mjs index 93d13be0..8e8ef7bf 100644 --- a/scripts/extract-release-label.mjs +++ b/scripts/extract-release-label.mjs @@ -7,7 +7,11 @@ if (process.argv.length < 3) { } const prTitle = process.argv[2]; -const prLabel = prTitle.split(':')[0].trim(); + +// Parse the conventional-commit prefix `type(scope)!:`, keeping only the type +// and dropping an optional scope and breaking-change marker. +const prefixMatch = prTitle.match(/^\s*([a-zA-Z]+)(?:\([^)]*\))?!?:/); +const prLabel = prefixMatch ? prefixMatch[1].toLowerCase() : ''; const config = await load({ extends: ["./commitlint.config.js"] }); const commitPrefix = config?.rules?.['type-enum']?.[2] || [];