docs: update tool capability docs #38
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "CLA Check" | |
| on: | |
| pull_request_target: | |
| types: [opened, edited, synchronize] | |
| permissions: | |
| pull-requests: read | |
| jobs: | |
| cla-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check CLA agreement | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const pr = context.payload.pull_request; | |
| // Skip bot accounts. pr.user.type === 'Bot' 覆盖所有机器人,allowlist 作兜底。 | |
| const botList = ['dependabot[bot]', 'renovate[bot]', 'github-actions[bot]']; | |
| if (pr.user.type === 'Bot' || botList.includes(pr.user.login)) { | |
| console.log(`Skipping CLA check for bot: ${pr.user.login}`); | |
| return; | |
| } | |
| // Skip internal contributors (org owners, members, collaborators). | |
| // CLA is only required for external contributors (CONTRIBUTOR / FIRST_TIME_CONTRIBUTOR / FIRST_TIMER / NONE). | |
| const internalAssociations = ['OWNER', 'MEMBER', 'COLLABORATOR']; | |
| if (internalAssociations.includes(pr.author_association)) { | |
| console.log(`Skipping CLA check for internal contributor: ${pr.user.login} (${pr.author_association})`); | |
| return; | |
| } | |
| const body = pr.body || ''; | |
| // 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( | |
| '❌ CLA 检查未通过 / CLA check failed\n\n' + | |
| '请在 PR 描述中勾选「我已阅读并同意贡献者许可协议 (CLA)」后再提交。\n' + | |
| 'Please check the "I have read and agree to the Contributor License Agreement (CLA)" checkbox in the PR description before submitting.\n\n' + | |
| '如果 PR 描述中没有该选项,请使用仓库的 PR 模板重新创建。\n' + | |
| 'If the checkbox is missing, please recreate the PR using the repository PR template.' | |
| ); | |
| } |