From cbc55a7a9be33a3121fe845f42284f516bbab29c Mon Sep 17 00:00:00 2001 From: yi-ge Date: Fri, 8 May 2026 18:03:20 +0800 Subject: [PATCH] =?UTF-8?q?chore(cla):=20=E6=94=B9=E8=BF=9B=20bot=20?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E4=B8=8E=E5=8B=BE=E9=80=89=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - bot 跳过改用 pr.user.type === 'Bot',allowlist 保留作兜底; 此前只有 3 个特定 bot 在 allowlist,其他 bot(如 imgbot/pre-commit-ci)会被误判为 fail - CLA 勾选匹配兼容 [x] / [X];GitHub 二者都视为已勾选,原实现仅 includes('[x]') 会漏判 --- .github/workflows/cla.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 0734d7f..3870f5c 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -16,9 +16,9 @@ jobs: script: | const pr = context.payload.pull_request; - // Skip bot accounts + // Skip bot accounts. pr.user.type === 'Bot' 覆盖所有机器人,allowlist 作兜底。 const botList = ['dependabot[bot]', 'renovate[bot]', 'github-actions[bot]']; - if (botList.includes(pr.user.login)) { + if (pr.user.type === 'Bot' || botList.includes(pr.user.login)) { console.log(`Skipping CLA check for bot: ${pr.user.login}`); return; } @@ -32,9 +32,10 @@ jobs: } const body = pr.body || ''; - const claChecked = - body.includes('[x] 我已阅读并同意 [贡献者许可协议 (CLA)]') || - body.includes('[x] I have read and agree to the [Contributor License Agreement (CLA)]'); + // GitHub 将 [x] 与 [X] 均视为已勾选,宽松匹配以避免大小写误判。 + const zhRe = /\[[xX]\][^\n]*我已阅读并同意[^\n]*贡献者许可协议/; + const enRe = /\[[xX]\][^\n]*I have read and agree to the[^\n]*Contributor License Agreement/; + const claChecked = zhRe.test(body) || enRe.test(body); if (!claChecked) { core.setFailed(