From 267b374e1abee483e905b516b37e2f751076e3c1 Mon Sep 17 00:00:00 2001 From: Robin Bowes Date: Wed, 11 Nov 2026 17:01:54 +0000 Subject: [PATCH] ci: ignore co-author trailers in commitlint's footer length check Squash-merging a release PR adds a Co-authored-by trailer for the App that wrote its pin commit. The App's noreply address makes that line 110 characters, so commitlint failed on main for both release commits (v7.0.0 and v7.1.0). PR checks lint each commit separately and never see the trailer. footer-max-line-length becomes a function rule, like the body rule beside it, that skips Co-authored-by lines and still fails any other footer line over 100 characters. Co-Authored-By: Claude Opus 5.5 --- commitlint.config.mjs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/commitlint.config.mjs b/commitlint.config.mjs index b1e2a180..a0109203 100644 --- a/commitlint.config.mjs +++ b/commitlint.config.mjs @@ -14,6 +14,19 @@ const validateBodyMaxLengthIgnoringDeps = (parsedCommit) => { ] } +// A GitHub App's noreply address alone makes its co-author trailer too long. +const validateFooterMaxLengthIgnoringCoAuthors = (parsedCommit) => { + const footer = (parsedCommit.footer ?? '') + .split('\n') + .filter((line) => !/^co-authored-by:/i.test(line)) + .join('\n') + + return [ + !footer || maxLineLength(footer, bodyMaxLineLength), + `footer's lines must not be longer than ${bodyMaxLineLength}`, + ] +} + export default { extends: ['@commitlint/config-conventional'], plugins: ['commitlint-plugin-function-rules'], @@ -24,5 +37,11 @@ export default { 'always', validateBodyMaxLengthIgnoringDeps, ], + 'footer-max-line-length': [0], + 'function-rules/footer-max-line-length': [ + 2, + 'always', + validateFooterMaxLengthIgnoringCoAuthors, + ], }, }