|
| 1 | +# Copyright 2024-2026 the original author or authors. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Auto Comment for Clarity |
| 16 | +on: |
| 17 | + issues: |
| 18 | + types: [opened] |
| 19 | + discussion: |
| 20 | + types: [created] |
| 21 | +env: |
| 22 | + ANTHROPIC_BASE_URL: "https://open.bigmodel.cn/api/anthropic" |
| 23 | +jobs: |
| 24 | + auto-comment: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + permissions: |
| 27 | + contents: read |
| 28 | + issues: write |
| 29 | + discussions: write |
| 30 | + id-token: write |
| 31 | + steps: |
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Create clarity prompt |
| 36 | + run: | |
| 37 | + mkdir -p /tmp/claude-prompts |
| 38 | + cat > /tmp/claude-prompts/clarity-prompt.txt << 'EOF' |
| 39 | + 你是一个专业的社区助手。请分析以下 GitHub issue/discussion 的内容质量。 |
| 40 | + |
| 41 | + 任务: |
| 42 | + 1. 使用 mcp__github__get_issue 获取内容详情 |
| 43 | + 2. 分析内容是否包含足够的信息: |
| 44 | + - 问题描述是否清楚 |
| 45 | + - 是否包含重现步骤(如果是 bug) |
| 46 | + - 是否包含期望行为 |
| 47 | + - 是否包含环境信息 |
| 48 | + 3. 如果信息不足,使用 mcp__github__create_comment 添加友好的评论,要求补充信息 |
| 49 | + |
| 50 | + 评论模板: |
| 51 | + 感谢您提交这个 issue/discussion!为了更好地帮助您,请补充以下信息: |
| 52 | + - [ ] 详细的问题描述 |
| 53 | + - [ ] 重现步骤(如适用) |
| 54 | + - [ ] 期望的行为 |
| 55 | + - [ ] 实际的行为 |
| 56 | + - [ ] 环境信息(版本、操作系统等) |
| 57 | + |
| 58 | + 请编辑您的原始 issue/discussion 来添加这些信息。 |
| 59 | + EOF |
| 60 | + |
| 61 | + - name: Run Claude Code for Auto Comment |
| 62 | + uses: anthropics/claude-code-action@v1 |
| 63 | + with: |
| 64 | + prompt: $(cat /tmp/claude-prompts/clarity-prompt.txt) |
| 65 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 66 | + claude_args: | |
| 67 | + --allowedTools mcp__github__get_issue,mcp__github__create_comment |
| 68 | + --system-prompt "你是一个经验丰富的开源项目维护者,擅长识别高质量的 issue 报告" |
0 commit comments