32
32
- name : Checkout repository
33
33
uses : actions/checkout@v4
34
34
35
- - name : Analyze issue quality with Claude
36
- id : claude_analysis
37
- uses : anthropics/claude-code-action@v1
38
- with :
39
- anthropic_api_key : ${{ secrets.ANTHROPIC_API_KEY }}
40
- prompt : |
41
- 你是一个专业的开源项目社区助手。请分析以下 GitHub issue 的内容质量。
42
-
43
- Issue 标题: ${{ github.event.issue.title }}
44
- Issue 内容: ${{ github.event.issue.body }}
45
- Issue 标签: ${{ join(github.event.issue.labels.*.name, ', ') }}
46
-
47
- 请分析这个 issue 是否包含足够的信息:
48
- - 问题描述是否清楚
49
- - 是否包含重现步骤(如果是 bug)
50
- - 是否包含期望行为和实际行为
51
- - 是否包含环境信息
52
-
53
- 如果信息不足,请输出一个友好的评论内容,要求补充信息。如果信息充足,请输出 "SUFFICIENT" 表示不需要补充。
54
-
55
- 评论应该友好、专业,使用中文,格式如下:
56
-
57
- 感谢您提交这个 issue!为了更好地帮助您解决问题,请补充以下信息:
58
-
59
- - [ ] 详细的问题描述
60
- - [ ] 重现步骤(如适用)
61
- - [ ] 期望的行为
62
- - [ ] 实际的行为
63
- - [ ] 环境信息(版本、操作系统等)
64
-
65
- 请编辑您的原始 issue 来添加这些信息,这将帮助我们更快地定位和解决问题。
66
-
67
- 只输出评论内容,不要添加任何其他解释。
68
-
69
- - name : Create comment if needed
35
+ - name : Analyze issue and create comment
70
36
uses : actions/github-script@v7
71
37
with :
72
38
github-token : ${{ secrets.GITHUB_TOKEN }}
@@ -75,19 +41,36 @@ jobs:
75
41
const owner = context.repo.owner;
76
42
const repo = context.repo.repo;
77
43
78
- // Get Claude's analysis result
79
- const stepOutputs = ${{ toJson(steps.claude_analysis.outputs) }};
80
- const analysisResult = (stepOutputs.response || stepOutputs.result || stepOutputs.output || '').trim();
44
+ // Get issue details
45
+ const issueTitle = context.payload.issue.title || '';
46
+ const issueBody = context.payload.issue.body || '';
47
+ const issueLabels = context.payload.issue.labels?.map(label => label.name).join(', ') || '';
48
+
49
+ console.log('Issue Title:', issueTitle);
50
+ console.log('Issue Body:', issueBody);
51
+ console.log('Issue Labels:', issueLabels);
52
+
53
+ // Simple analysis logic
54
+ const hasDetailedDescription = issueBody.length > 50 && !issueBody.includes('No response');
55
+ const hasStepsToReproduce = issueBody.toLowerCase().includes('步骤') || issueBody.toLowerCase().includes('重现') || issueBody.toLowerCase().includes('reproduce');
56
+ const hasEnvironmentInfo = issueBody.toLowerCase().includes('环境') || issueBody.toLowerCase().includes('版本') || issueBody.toLowerCase().includes('version');
57
+ const hasExpectedBehavior = issueBody.toLowerCase().includes('期望') || issueBody.toLowerCase().includes('expected');
58
+
59
+ // Check if this looks like a bug report that needs more info
60
+ const isBugReport = issueTitle.toLowerCase().includes('bug') || issueTitle.toLowerCase().includes('错误');
61
+ const needsMoreInfo = isBugReport && (!hasDetailedDescription || !hasStepsToReproduce || !hasEnvironmentInfo);
62
+
63
+ // Also check for very short descriptions
64
+ const hasVeryShortDescription = issueBody.trim().length < 20 || issueBody === 'No response' || issueBody.includes('这个怎么用');
81
65
82
- console.log('Claude analysis result:', analysisResult);
66
+ if (needsMoreInfo || hasVeryShortDescription) {
67
+ const commentBody = '👋 感谢您提交这个 issue!\\n\\n为了更好地帮助您解决问题,请补充以下信息:\\n\\n- [ ] **详细的问题描述**:请详细描述您遇到的具体问题\\n- [ ] **重现步骤**:请提供能够重现问题的具体步骤\\n- [ ] **期望的行为**:请描述您期望的正确行为应该是什么\\n- [ ] **实际的行为**:请描述实际发生了什么\\n- [ ] **环境信息**:\\n - mem4j 版本\\n - Java 版本\\n - 操作系统\\n - 其他相关配置\\n\\n请编辑您的原始 issue 来添加这些信息,这将帮助我们更快地定位和解决问题。🙏';
83
68
84
- // Only post comment if Claude suggests the issue needs more information
85
- if (analysisResult && analysisResult !== 'SUFFICIENT' && analysisResult !== '') {
86
69
await github.rest.issues.createComment({
87
70
owner,
88
71
repo,
89
72
issue_number,
90
- body: analysisResult
73
+ body: commentBody
91
74
});
92
75
console.log('Posted clarity request comment to issue #' + issue_number);
93
76
} else {
0 commit comments