Skip to content

[BUG] 这个怎么用啊 #3

[BUG] 这个怎么用啊

[BUG] 这个怎么用啊 #3

# Copyright 2024-2026 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Auto Comment for Clarity
on:
issues:
types: [opened]
discussion:
types: [created]
env:
ANTHROPIC_BASE_URL: "https://open.bigmodel.cn/api/anthropic"
jobs:
auto-comment:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
discussions: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Analyze issue quality with Claude
id: claude_analysis
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
你是一个专业的开源项目社区助手。请分析以下 GitHub issue 的内容质量。
Issue 标题: ${{ github.event.issue.title }}
Issue 内容: ${{ github.event.issue.body }}
Issue 标签: ${{ join(github.event.issue.labels.*.name, ', ') }}
请分析这个 issue 是否包含足够的信息:
- 问题描述是否清楚
- 是否包含重现步骤(如果是 bug)
- 是否包含期望行为和实际行为
- 是否包含环境信息
如果信息不足,请输出一个友好的评论内容,要求补充信息。如果信息充足,请输出 "SUFFICIENT" 表示不需要补充。
评论应该友好、专业,使用中文,格式如下:
感谢您提交这个 issue!为了更好地帮助您解决问题,请补充以下信息:
- [ ] 详细的问题描述
- [ ] 重现步骤(如适用)
- [ ] 期望的行为
- [ ] 实际的行为
- [ ] 环境信息(版本、操作系统等)
请编辑您的原始 issue 来添加这些信息,这将帮助我们更快地定位和解决问题。
只输出评论内容,不要添加任何其他解释。
- name: Create comment if needed
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
// Get Claude's analysis result
const stepOutputs = ${{ toJson(steps.claude_analysis.outputs) }};
const analysisResult = (stepOutputs.response || stepOutputs.result || stepOutputs.output || '').trim();
console.log('Claude analysis result:', analysisResult);
// Only post comment if Claude suggests the issue needs more information
if (analysisResult && analysisResult !== 'SUFFICIENT' && analysisResult !== '') {
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body: analysisResult
});
console.log('Posted clarity request comment to issue #' + issue_number);
} else {
console.log('Issue has sufficient information, no comment needed');
}