From 80654f14f1b49f02dacbd0d01fec38fff8310f30 Mon Sep 17 00:00:00 2001 From: jyxjjj <773933146@qq.com> Date: Thu, 3 Jul 2025 15:26:24 +0800 Subject: [PATCH] Update PR title validation and feedback messages Improves the PR title regex to be non-greedy and adds 'chore' to the allowed prefixes. Enhances feedback comments with clearer instructions in both Chinese and English, including guidance for PRs spanning multiple components. --- .github/workflows/issue_pr_comment.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/issue_pr_comment.yml b/.github/workflows/issue_pr_comment.yml index fb952ed5..44f6e0af 100644 --- a/.github/workflows/issue_pr_comment.yml +++ b/.github/workflows/issue_pr_comment.yml @@ -47,10 +47,12 @@ jobs: with: script: | const title = context.payload.pull_request.title || ""; - const ok = /^(feat|docs|fix|style|refactor|chore)\(.+\): /i.test(title); + const ok = /^(feat|docs|fix|style|refactor|chore)\(.+?\): /i.test(title); if (!ok) { - let comment = "⚠️ PR 标题需以 `feat(): `, `docs(): `, `fix(): `, `style(): `, `refactor(): ` 其中之一开头,例如:`feat(component): 新增功能`。"; - comment += "⚠️ The PR title must start with `feat(): `, `docs(): `, `fix(): `, `style(): `, or `refactor(): `. For example: `feat(component): add new feature`.\n\n"; + let comment = "⚠️ PR 标题需以 `feat(): `, `docs(): `, `fix(): `, `style(): `, `refactor(): `, `chore(): ` 其中之一开头,例如:`feat(component): 新增功能`。\n"; + comment += "⚠️ The PR title must start with `feat(): `, `docs(): `, `fix(): `, `style(): `, or `refactor(): `, `chore(): `. For example: `feat(component): add new feature`.\n\n"; + comment += "如果跨多个组件,请使用主要组件作为前缀,并在标题中枚举、描述中说明。\n"; + comment += "If it spans multiple components, use the main component as the prefix and enumerate in the title, describe in the body.\n\n"; await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number,