diff --git a/.github/ISSUE_TEMPLATE/00-bug_report_zh.yml b/.github/ISSUE_TEMPLATE/00-bug_report_zh.yml index ec18a650b..42c61d51f 100644 --- a/.github/ISSUE_TEMPLATE/00-bug_report_zh.yml +++ b/.github/ISSUE_TEMPLATE/00-bug_report_zh.yml @@ -82,9 +82,17 @@ body: label: 复现链接(可选) description: | 请提供能复现此问题的链接。 - - type: textarea + - type: checkboxes id: aigenerated attributes: - label: AI生成内容(可选) - description: | - 如果此问题是由AI辅助您发现的,请提供全部聊天记录,包括使用的模型信息。 + label: AI生成内容 + description: 必须且只能勾选一项,请勿删除或修改声明文字。 + options: + - label: 我使用了AI工具生成此内容 + - label: 我没有使用AI工具生成此内容 + - type: input + id: ai-model + attributes: + label: AI模型是 + description: 如果使用了AI工具,请填写模型名称;未使用则留空。 + placeholder: xxx diff --git a/.github/ISSUE_TEMPLATE/01-bug_report_en.yml b/.github/ISSUE_TEMPLATE/01-bug_report_en.yml index 0085d4de5..3e9001915 100644 --- a/.github/ISSUE_TEMPLATE/01-bug_report_en.yml +++ b/.github/ISSUE_TEMPLATE/01-bug_report_en.yml @@ -82,9 +82,17 @@ body: label: Reproduction Link (optional) description: | Please provide a link to a repo or page that can reproduce this issue. - - type: textarea + - type: checkboxes id: aigenerated attributes: - label: AI Generated Content (optional) - description: | - If this issue was identified with the assistance of AI, please provide the complete chat log, including information about the model used. + label: AI Generated Content + description: Select exactly one option. Do not delete or modify the disclosure text. + options: + - label: I used AI tools to generate this content + - label: I did not use AI tools to generate this content + - type: input + id: ai-model + attributes: + label: AI model used + description: If you used AI tools, enter the model name; otherwise leave this blank. + placeholder: xxx diff --git a/.github/ISSUE_TEMPLATE/02-feature_request_zh.yml b/.github/ISSUE_TEMPLATE/02-feature_request_zh.yml index 907240261..def688e2f 100644 --- a/.github/ISSUE_TEMPLATE/02-feature_request_zh.yml +++ b/.github/ISSUE_TEMPLATE/02-feature_request_zh.yml @@ -48,9 +48,17 @@ body: label: 附加信息 description: | 相关的任何其他上下文或截图,或者你觉得有帮助的信息 - - type: textarea + - type: checkboxes id: aigenerated attributes: - label: AI生成内容(可选) - description: | - 如果此请求是由AI辅助您提交的,请提供全部聊天记录,包括使用的模型信息。 + label: AI生成内容 + description: 必须且只能勾选一项,请勿删除或修改声明文字。 + options: + - label: 我使用了AI工具生成此内容 + - label: 我没有使用AI工具生成此内容 + - type: input + id: ai-model + attributes: + label: AI模型是 + description: 如果使用了AI工具,请填写模型名称;未使用则留空。 + placeholder: xxx diff --git a/.github/ISSUE_TEMPLATE/03-feature_request_en.yml b/.github/ISSUE_TEMPLATE/03-feature_request_en.yml index 393118592..796f0e6c1 100644 --- a/.github/ISSUE_TEMPLATE/03-feature_request_en.yml +++ b/.github/ISSUE_TEMPLATE/03-feature_request_en.yml @@ -48,9 +48,17 @@ body: label: Additional Information description: | Any other context or screenshots related to this feature request, or information you find helpful. - - type: textarea + - type: checkboxes id: aigenerated attributes: - label: AI Generated Content (optional) - description: | - If this request was submitted with the assistance of an AI, please provide the complete chat log, including information about the model used. + label: AI Generated Content + description: Select exactly one option. Do not delete or modify the disclosure text. + options: + - label: I used AI tools to generate this content + - label: I did not use AI tools to generate this content + - type: input + id: ai-model + attributes: + label: AI model used + description: If you used AI tools, enter the model name; otherwise leave this blank. + placeholder: xxx diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml new file mode 100644 index 000000000..f8b209035 --- /dev/null +++ b/.github/workflows/issue_comment.yml @@ -0,0 +1,75 @@ +name: Issue Auto Reply + +on: + issues: + types: [opened] + +permissions: + issues: write + +jobs: + auto-reply: + runs-on: ubuntu-latest + steps: + - name: Check issue for unchecked tasks and reply + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 + with: + script: | + if (context.payload.issue.title.startsWith('[Announcements]')) return; + const titleNotEdited = /(请修改标题|Please modify the title)/i.test(context.payload.issue.title); + const issueBody = context.payload.issue.body || ""; + const aiSection = issueBody.match(/^### (AI生成内容|AI Generated Content)\r?\n([\s\S]*?)(?=^### |$(?![\s\S]))/m); + const aiOptionsPattern = aiSection?.[1] === 'AI生成内容' + ? /^\s*- \[([ xX])\] 我使用了AI工具生成此内容\r?\n- \[([ xX])\] 我没有使用AI工具生成此内容\s*$/ + : /^\s*- \[([ xX])\] I used AI tools to generate this content\r?\n- \[([ xX])\] I did not use AI tools to generate this content\s*$/; + const aiOptions = (aiSection?.[2] || '').match(aiOptionsPattern); + const validAiDisclosure = aiOptions !== null && (aiOptions[1] !== ' ') !== (aiOptions[2] !== ' '); + const aiModelSection = issueBody.match(/^### (AI模型是|AI model used)\r?\n([\s\S]*?)(?=^### |$(?![\s\S]))/m); + const aiModel = (aiModelSection?.[2] || '').trim(); + const missingAiModel = validAiDisclosure && aiOptions[1] !== ' ' && (aiModel === '' || aiModel === '_No response_'); + const confirmNotRead = /- \[[xX]\] (?:我没有阅读这个清单|I have not read these checkboxes)/.test(issueBody); + const closeIssue = titleNotEdited || confirmNotRead || !validAiDisclosure || missingAiModel; + let comment; + if (titleNotEdited) { + comment = `⚠️ 请修改标题以更好地描述您的问题或需求,并删除示例提示。当前 Issue 将被自动关闭并锁定。如需继续提交,请创建新的 Issue。 + ⚠️ Please modify the title to better describe your issue or request, and remove the example prompt. This issue will be automatically closed and locked. If you wish to proceed, please create a new issue. + `; + } else if (confirmNotRead || !validAiDisclosure || missingAiModel) { + comment = `⚠️ 你的 Issue 不符合提交规则。请先阅读相关规范后再重新提交。当前 Issue 将被自动关闭并锁定。如需继续提交,请确认已了解规则后创建新的 Issue。 + ⚠️ Your issue does not comply with the submission rules. Please read the guidelines before submitting again. This issue will be automatically closed and locked. If you wish to proceed, please confirm that you have reviewed the rules before creating a new issue. + `; + } else if (/- \[ \] (?!我没有阅读这个清单|I have not read these checkboxes)/.test(issueBody.replace(aiSection[0], ''))) { + comment = `感谢您联系OpenList。我们会尽快回复您。 + Thanks for contacting OpenList. We will reply to you as soon as possible. + + 由于您提出的 Issue 中包含部分未确认的项目,为了更好地管理项目,在人工审核后可能会直接关闭此问题。 + 如果您能确认并补充相关未确认项目的信息,欢迎随时重新提交。我们会及时关注并处理。感谢您的理解与支持! + Since your issue contains some unchecked tasks, it may be closed after manual review. + If you can confirm and provide information for the unchecked tasks, feel free to resubmit. + We will pay attention and handle it in a timely manner. + + 感谢您的理解与支持! + Thank you for your understanding and support! + `; + } else { + return; + } + + await github.rest.issues.createComment({ + ...context.repo, + issue_number: context.issue.number, + body: comment + }); + if (closeIssue) { + await github.rest.issues.update({ + ...context.repo, + issue_number: context.issue.number, + state: 'closed', + state_reason: 'not_planned', + labels: ['invalid'] + }); + await github.rest.issues.lock({ + ...context.repo, + issue_number: context.issue.number + }); + } diff --git a/.github/workflows/issue_pr_comment.yml b/.github/workflows/issue_pr_comment.yml deleted file mode 100644 index d8a3a4a06..000000000 --- a/.github/workflows/issue_pr_comment.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Issue or PR Auto Reply - -on: - issues: - types: [opened] - pull_request_target: - types: [opened] - -permissions: - issues: write - pull-requests: write - -jobs: - auto-reply: - runs-on: ubuntu-latest - if: github.event_name == 'issues' - steps: - - name: Check issue for unchecked tasks and reply - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 - with: - script: | - let comment = ""; - const issueTitle = context.payload.issue.title || ""; - const titleNotEdited = /(请修改标题|Please modify the title)/i.test(issueTitle); - if (titleNotEdited) { - comment = "⚠️ 请修改标题以更好地描述您的问题或需求,并删除示例提示。当前 Issue 将被自动关闭。如需继续提交,请创建新的 Issue。\n"; - comment += "⚠️ Please modify the title to better describe your issue or request, and remove the example prompt. This issue will be automatically closed. If you wish to proceed, please create a new issue.\n"; - await github.rest.issues.createComment({ - ...context.repo, - issue_number: context.issue.number, - body: comment - }); - await github.rest.issues.update({ - ...context.repo, - issue_number: context.issue.number, - state: 'closed', - state_reason: 'not_planned', - labels: ['invalid'] - }); - return; - } - const issueBody = context.payload.issue.body || ""; - const confirmHasRead = /- \[ \] (?!我没有阅读这个清单|I have not read these checkboxes)/.test(issueBody); - const confirmNotRead = /- \[[xX]\] (?:我没有阅读这个清单|I have not read these checkboxes)/.test(issueBody); - if (confirmNotRead) { - comment = "⚠️ 你的 Issue 不符合提交规则。请先阅读相关规范后再重新提交。当前 Issue 将被自动关闭。如需继续提交,请确认已了解规则后重新打开或创建新的 Issue。\n"; - comment += "⚠️ Your issue does not comply with the submission rules. Please read the guidelines before submitting again. This issue will be automatically closed. If you wish to proceed, please confirm that you have reviewed the rules before reopening or creating a new issue.\n"; - await github.rest.issues.createComment({ - ...context.repo, - issue_number: context.issue.number, - body: comment - }); - await github.rest.issues.update({ - ...context.repo, - issue_number: context.issue.number, - state: 'closed', - state_reason: 'not_planned', - labels: ['invalid'] - }); - return; - } - if (confirmHasRead) { - comment = "感谢您联系OpenList。我们会尽快回复您。\n"; - comment += "Thanks for contacting OpenList. We will reply to you as soon as possible.\n\n"; - comment += "由于您提出的 Issue 中包含部分未确认的项目,为了更好地管理项目,在人工审核后可能会直接关闭此问题。\n"; - comment += "如果您能确认并补充相关未确认项目的信息,欢迎随时重新提交。我们会及时关注并处理。感谢您的理解与支持!\n"; - comment += "Since your issue contains some unchecked tasks, it may be closed after manual review.\n"; - comment += "If you can confirm and provide information for the unchecked tasks, feel free to resubmit.\n"; - comment += "We will pay attention and handle it in a timely manner.\n\n"; - comment += "感谢您的理解与支持!\n"; - comment += "Thank you for your understanding and support!\n"; - await github.rest.issues.createComment({ - ...context.repo, - issue_number: context.issue.number, - body: comment - }); - } - - pr-title-check: - runs-on: ubuntu-latest - if: github.event_name == 'pull_request_target' - steps: - - name: Check PR title for required prefix and comment - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 - with: - script: | - const title = context.payload.pull_request.title || ""; - const ok = /^(feat|docs|fix|style|refactor|chore)\(.+?\)!?: /i.test(title); - if (!ok) { - 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"; - comment += "如果是破坏性变更,请在类型后添加 `!`,例如 `feat(component)!: 破坏性变更`。\n"; - comment += "For breaking changes, add `!` after the type, e.g., `feat(component)!: breaking change`.\n\n"; - await github.rest.issues.createComment({ - ...context.repo, - issue_number: context.issue.number, - body: comment - }); - } diff --git a/.github/workflows/pr_title_check.yml b/.github/workflows/pr_title_check.yml new file mode 100644 index 000000000..45707af7c --- /dev/null +++ b/.github/workflows/pr_title_check.yml @@ -0,0 +1,34 @@ +name: PR Title Check + +on: + pull_request_target: + types: [opened] + +permissions: + pull-requests: write + +jobs: + pr-title-check: + runs-on: ubuntu-latest + steps: + - name: Check PR title for required prefix and comment + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 + with: + script: | + const title = context.payload.pull_request.title; + if (/^(feat|docs|fix|style|refactor|chore)\(.+?\)!?: /i.test(title)) return; + const comment = `⚠️ PR 标题需以 \`feat(): \`, \`docs(): \`, \`fix(): \`, \`style(): \`, \`refactor(): \`, \`chore(): \` 其中之一开头,例如:\`feat(component): 新增功能\`。 + ⚠️ The PR title must start with \`feat(): \`, \`docs(): \`, \`fix(): \`, \`style(): \`, or \`refactor(): \`, \`chore(): \`. For example: \`feat(component): add new feature\`. + + 如果跨多个组件,请使用主要组件作为前缀,并在标题中枚举、描述中说明。 + If it spans multiple components, use the main component as the prefix and enumerate in the title, describe in the body. + + 如果是破坏性变更,请在类型后添加 \`!\`,例如 \`feat(component)!: 破坏性变更\`。 + For breaking changes, add \`!\` after the type, e.g., \`feat(component)!: breaking change\`. + + `; + await github.rest.issues.createComment({ + ...context.repo, + issue_number: context.issue.number, + body: comment + });