From b1583c4e8748bf45549c0915b76ab766bc8a4ee3 Mon Sep 17 00:00:00 2001 From: Aparencia Date: Thu, 30 Jul 2026 09:18:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E6=94=BE=E5=BC=80=20commitlint=20bo?= =?UTF-8?q?dy/footer=20=E8=A1=8C=E9=95=BF=E9=99=90=E5=88=B6=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=91=E7=89=88=E6=8F=90=E4=BA=A4=E8=A2=AB?= =?UTF-8?q?=E8=87=AA=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v0.25.0 发版失败根因:semantic-release 已完成版本计算与 CHANGELOG 生成, 但其自动创建的 chore(release) 提交 body 由 release notes 生成,天然含超长 commit URL 行,被我们刚启用的 commitlint body-max-line-length(100) 规则 经 husky commit-msg 钩子拦截(@semantic-release/git 插件执行 git commit 失败)。 处置:禁用 body-max-line-length 与 footer-max-line-length。该两条规则在 本仓库场景只会拦截合法提交(发布提交与人工贴链接),header 结构、type 枚举 等核心 Conventional Commits 校验全部保留。 验证:用实际失败的发版提交信息(含 140+ 字符 URL 行)过 commitlint,exit 0。 --- commitlint.config.js | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/commitlint.config.js b/commitlint.config.js index 6bdd182e..80fac29e 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,17 +1,22 @@ -/** - * @ai-context - * commitlint 配置:校验 Conventional Commits,type 集合与 .releaserc.json releaseRules 严格对齐。 - * Commitlint config aligned with semantic-release commit-analyzer release rules. - */ -module.exports = { - extends: ['@commitlint/config-conventional'], - rules: { - 'type-enum': [ - 2, - 'always', - ['feat', 'fix', 'perf', 'refactor', 'revert', 'docs', 'style', 'test', 'build', 'ci', 'chore'], - ], - // 中文 subject 不适用大小写规则 - 'subject-case': [0], - }, -}; +/** + * @ai-context + * commitlint 配置:校验 Conventional Commits,type 集合与 .releaserc.json releaseRules 严格对齐。 + * Commitlint config aligned with semantic-release commit-analyzer release rules. + */ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [ + 2, + 'always', + ['feat', 'fix', 'perf', 'refactor', 'revert', 'docs', 'style', 'test', 'build', 'ci', 'chore'], + ], + // 中文 subject 不适用大小写规则 + 'subject-case': [0], + // semantic-release 自动发布提交(chore(release): vX.Y.Z)的 body 由 release notes + // 生成,天然含超长 commit URL 行;人工提交贴链接同样常见。 + // 行长限制在此场景只会拦截合法提交(已实际导致 v0.25.0 发布失败),故禁用。 + 'body-max-line-length': [0], + 'footer-max-line-length': [0], + }, +};