Update pr-checklist-check.yml
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
name: PR Checklist Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
pull_request_target:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
jobs:
|
||||
@@ -11,6 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
steps:
|
||||
- name: Check if user checked "我没有认真阅读"
|
||||
@@ -20,8 +21,8 @@ jobs:
|
||||
script: |
|
||||
const body = context.payload.pull_request.body || '';
|
||||
|
||||
// 只匹配:整行是 - [x] + 包含“没有认真阅读”
|
||||
const regex = /-\s*\[\s*x\s*\].*我\*\*没有\*\*认真阅读以上内容/im;
|
||||
// 精确匹配完整的 checklist 项:- [x] 或 - [X] 后跟完整句子,忽略大小写和多余空格
|
||||
const regex = /-+\s*\[\s*[xX]\s*\]\s*⚠️\s*我\*\*没有\*\*认真阅读以上内容,直接提交。/im;
|
||||
const isBad = regex.test(body);
|
||||
|
||||
return isBad;
|
||||
@@ -39,7 +40,8 @@ jobs:
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: prNumber,
|
||||
body: `👋 @${author}
|
||||
body: |
|
||||
👋 @${author}
|
||||
|
||||
您的 PR 未通过检查清单校验 —— 检测到您勾选了「我**没有**认真阅读以上内容,直接提交」。
|
||||
|
||||
@@ -61,7 +63,7 @@ Please follow these rules and reopen a new PR:
|
||||
2. Make sure your development is **based on the \`dev\` branch**, and set the PR target branch to the **development branch (\`dev\`)** (only merge to main if extremely urgent).
|
||||
3. Once you have reviewed everything, please open a new PR.
|
||||
|
||||
This PR has been automatically closed. Please reopen a correct one. Thank you for your contribution! 🙏`
|
||||
This PR has been automatically closed. Please reopen a correct one. Thank you for your contribution! 🙏
|
||||
});
|
||||
|
||||
await github.rest.pulls.update({
|
||||
|
||||
Reference in New Issue
Block a user