hyperchat/.github/workflows/auto-comment-issue2.yml

176 lines
7.1 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: HyperChat Auto Comment Issue 2.0
on:
issues:
types: [opened]
jobs:
hyperchat-auto-comment:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install GitHub CLI
run: |
# 安装 GitHub CLI
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y
- name: Authenticate GitHub CLI
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Get Issue Information
id: issue_info
run: |
# 获取Issue详细信息
ISSUE_INFO=$(gh issue view ${{ github.event.issue.number }} --json title,body,author,labels,url --repo ${{ github.repository }})
echo "ISSUE_DATA<<EOF" >> $GITHUB_OUTPUT
echo "$ISSUE_INFO" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Run HyperChat Analysis and Comment
run: |
# 创建分析提示
ANALYSIS_PROMPT="你是 HyperChat 项目的专业 Issue 分析助手。请先仔细阅读项目的 CLAUDE.md 文件,学习项目的详细信息,然后使用 gh 命令分析并回复下面的 GitHub Issue。
## 第一步:学习项目信息
请先使用以下命令读取项目文档:
\`cat CLAUDE.md\`
仔细学习文档中的:
- 项目概述和架构
- 开发逻辑和最佳实践
- 包结构和构建命令
- 已完成功能和待办事项
- 常见问题解决方案
## 第二步分析Issue信息
- **Repository**: ${{ github.repository }}
- **Issue Number**: ${{ github.event.issue.number }}
- **Issue Title**: ${{ github.event.issue.title }}
- **Issue Author**: ${{ github.event.issue.user.login }}
- **Issue URL**: ${{ github.event.issue.html_url }}
**Issue 内容**:
${{ github.event.issue.body }}
## 第三步:深度分析任务
基于 CLAUDE.md 中学到的项目知识,完成以下分析:
1. **问题分类**确定Issue类型Bug报告/功能请求/使用问题/文档问题/开发指导等)
2. **影响评估**:评估问题的严重程度和影响范围(参考项目架构)
3. **技术分析**:基于项目的技术栈和架构提供专业判断
4. **解决建议**:参考项目的开发最佳实践和已有功能提供具体建议
5. **资源指引**:指向相关的文档、代码文件或构建命令
## 第四步:执行回复和标签
使用以下命令完成任务:
- 首先回复Issue\`gh issue comment ${{ github.event.issue.number }} --repo ${{ github.repository }} --body \"你的专业回复内容\"\`
- 然后添加相关标签:\`gh issue edit ${{ github.event.issue.number }} --repo ${{ github.repository }} --add-label \"标签1,标签2,标签3\"\`
## 增强回复格式模板
🤖 **HyperChat AI 助手自动回复**
感谢你提交这个 Issue我已经基于项目文档深入分析了你的问题
**📋 问题分析**
- **类型**[具体类型]
- **影响范围**[基于项目架构的具体范围]
- **严重程度**[评估等级]
**🔍 技术分析**
[基于CLAUDE.md中的技术栈、架构和开发逻辑的深度分析]
**💡 解决建议**
[参考项目最佳实践和已有功能的具体建议]
**📚 相关资源**
- 🛠️ [开发指南](https://github.com/${{ github.repository }}/blob/dev2/CLAUDE.md)
- 📖 [项目文档](https://github.com/${{ github.repository }}/blob/dev2/README.md)
- [其他相关文件或命令,基于分析结果]
**🚀 下一步行动**
[基于项目当前状态和开发流程的具体指导]
如需进一步帮助,请提供更多技术细节!
---
*此回复基于项目文档智能生成,由 HyperChat AI 助手提供*
## 可用标签参考
**问题类型标签**
- bugBug报告
- enhancement功能请求
- question使用问题
- documentation文档问题
- help wanted需要帮助
- good first issue适合新手
**影响范围标签**
- frontend前端相关
- backend后端相关
- cliCLI工具相关
- electron桌面应用相关
- webWeb应用相关
- shared共享代码相关
**严重程度标签**
- priority:low低优先级
- priority:medium中优先级
- priority:high高优先级
- priority:critical紧急
**其他标签**
- duplicate重复问题
- wontfix不会修复
- invalid无效问题
- auto-analyzed自动分析
## 执行要求
**重要**:请严格按照以下步骤执行:
1. **第一步**:先执行 \`cat CLAUDE.md\` 学习项目详细信息
2. **第二步**基于学到的知识分析Issue
3. **第三步**:执行 \`gh issue comment\` 命令发布专业回复
4. **第四步**:执行 \`gh issue edit --add-label\` 命令添加2-4个最相关标签
5. **必须**:确保所有命令都能成功执行,回复内容要体现对项目的深度理解"
# 使用 HyperChat 进行分析和回复
npx @dadigua/hyperchat@latest "$ANALYSIS_PROMPT"
env:
# GitHub Token for gh CLI (already authenticated above)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# HyperChat 配置
HyperChat_API_URL: ${{ secrets.HyperChat_API_URL }}
HyperChat_API_KEY: ${{ secrets.HyperChat_API_KEY }}
HyperChat_AI_Provider: ${{ secrets.HyperChat_AI_Provider }}
HyperChat_AI_Model: ${{ secrets.HyperChat_AI_Model }}
- name: Fallback Comment on Failure
if: failure()
run: |
gh issue comment ${{ github.event.issue.number }} --repo ${{ github.repository }} --body "🤖 **HyperChat AI 助手**
抱歉,自动分析系统遇到了问题,无法生成智能回复。
请耐心等待项目维护者的人工回复,或者在 [讨论区](https://github.com/${{ github.repository }}/discussions) 寻求帮助。
---
*此消息由自动化系统生成*"