File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 script : |
1717 const pr = context.payload.pull_request;
1818
19- // Skip bot accounts
19+ // Skip bot accounts. pr.user.type === 'Bot' 覆盖所有机器人,allowlist 作兜底。
2020 const botList = ['dependabot[bot]', 'renovate[bot]', 'github-actions[bot]'];
21- if (botList.includes(pr.user.login)) {
21+ if (pr.user.type === 'Bot' || botList.includes(pr.user.login)) {
2222 console.log(`Skipping CLA check for bot: ${pr.user.login}`);
2323 return;
2424 }
3232 }
3333
3434 const body = pr.body || '';
35- const claChecked =
36- body.includes('[x] 我已阅读并同意 [贡献者许可协议 (CLA)]') ||
37- body.includes('[x] I have read and agree to the [Contributor License Agreement (CLA)]');
35+ // GitHub 将 [x] 与 [X] 均视为已勾选,宽松匹配以避免大小写误判。
36+ const zhRe = /\[[xX]\][^\n]*我已阅读并同意[^\n]*贡献者许可协议/;
37+ const enRe = /\[[xX]\][^\n]*I have read and agree to the[^\n]*Contributor License Agreement/;
38+ const claChecked = zhRe.test(body) || enRe.test(body);
3839
3940 if (!claChecked) {
4041 core.setFailed(
You can’t perform that action at this time.
0 commit comments