fix(ci): 修复 AI 工具 workflow 的 YAML 语法错误
This commit is contained in:
83
.github/workflows/ai-issue-helper.yml
vendored
83
.github/workflows/ai-issue-helper.yml
vendored
@@ -14,37 +14,76 @@ jobs:
|
|||||||
# 只在用户提到 @ai-helper 时触发
|
# 只在用户提到 @ai-helper 时触发
|
||||||
if: contains(github.event.comment.body, '@ai-helper')
|
if: contains(github.event.comment.body, '@ai-helper')
|
||||||
steps:
|
steps:
|
||||||
- name: AI Assistance
|
- name: Get Issue Details
|
||||||
uses: github/issue-assessment-action@v1
|
id: issue
|
||||||
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
assessments:
|
script: |
|
||||||
- name: help-request
|
const issue = await github.rest.issues.get({
|
||||||
prompt: |
|
owner: context.repo.owner,
|
||||||
用户在 issue 中提到了 @ai-helper,请分析他们的问题并提供帮助。
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.issue.number
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
title: issue.data.title,
|
||||||
|
body: issue.data.body,
|
||||||
|
number: issue.data.number
|
||||||
|
};
|
||||||
|
|
||||||
检查:
|
- name: AI Analysis
|
||||||
1. 用户遇到的具体问题
|
uses: actions/ai-inference@v1
|
||||||
|
id: ai
|
||||||
|
with:
|
||||||
|
model: 'gpt-4o-mini'
|
||||||
|
system-prompt: |
|
||||||
|
你是 ECS Framework 项目的 AI 助手。
|
||||||
|
项目信息:
|
||||||
|
- 这是一个高性能 TypeScript ECS (Entity-Component-System) 框架
|
||||||
|
- 支持 Cocos Creator、Laya 引擎和 Web 平台
|
||||||
|
- 文档地址:https://esengine.github.io/ecs-framework/
|
||||||
|
- AI 文档:https://deepwiki.com/esengine/ecs-framework
|
||||||
|
|
||||||
|
请用中文友好地回复用户的问题。
|
||||||
|
prompt: |
|
||||||
|
用户在 Issue #${{ github.event.issue.number }} 中请求帮助。
|
||||||
|
|
||||||
|
Issue 标题:${{ steps.issue.outputs.result.title }}
|
||||||
|
|
||||||
|
Issue 内容:
|
||||||
|
${{ steps.issue.outputs.result.body }}
|
||||||
|
|
||||||
|
用户评论:
|
||||||
|
${{ github.event.comment.body }}
|
||||||
|
|
||||||
|
请分析用户的问题并提供帮助:
|
||||||
|
1. 问题分析
|
||||||
2. 可能的解决方案
|
2. 可能的解决方案
|
||||||
3. 相关文档链接
|
3. 相关文档链接
|
||||||
4. 类似的已解决 issue
|
4. 需要补充的信息(如果有)
|
||||||
|
|
||||||
用中文友好地回复,提供:
|
用以下格式回复:
|
||||||
- 问题分析
|
|
||||||
- 建议的解决方案(如果可以推断)
|
|
||||||
- 相关资源链接
|
|
||||||
- 需要提供的额外信息(如果需要)
|
|
||||||
|
|
||||||
格式:
|
|
||||||
👋 你好!我是 AI 助手,让我帮你分析这个问题。
|
👋 你好!我是 AI 助手,让我帮你分析这个问题。
|
||||||
|
|
||||||
【问题分析】
|
**问题分析**
|
||||||
...
|
[分析内容]
|
||||||
|
|
||||||
【建议方案】
|
**建议方案**
|
||||||
...
|
[解决方案]
|
||||||
|
|
||||||
【相关资源】
|
**相关资源**
|
||||||
- 📚 文档:...
|
- 📚 [文档链接]
|
||||||
- 💡 示例:...
|
- 💡 [示例链接]
|
||||||
|
|
||||||
如果我的建议没有解决问题,请提供更多信息,维护者会尽快回复!
|
如果我的建议没有解决问题,请提供更多信息,维护者会尽快回复!
|
||||||
|
|
||||||
|
- name: Post AI Response
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
body: `${{ steps.ai.outputs.response }}`
|
||||||
|
});
|
||||||
|
|||||||
78
.github/workflows/ai-issue-moderator.yml
vendored
78
.github/workflows/ai-issue-moderator.yml
vendored
@@ -5,12 +5,6 @@ on:
|
|||||||
types: [opened]
|
types: [opened]
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: [created]
|
types: [created]
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
issue_number:
|
|
||||||
description: 'Issue 编号(留空则检查所有打开的 issue)'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
@@ -20,46 +14,42 @@ jobs:
|
|||||||
moderate:
|
moderate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Get issue number
|
- name: Check Content
|
||||||
id: issue
|
uses: actions/ai-inference@v1
|
||||||
run: |
|
id: check
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
||||||
if [ -n "${{ github.event.inputs.issue_number }}" ]; then
|
|
||||||
echo "number=${{ github.event.inputs.issue_number }}" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "number=all" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
- name: AI Content Moderation
|
|
||||||
uses: github/content-moderation-action@v1
|
|
||||||
with:
|
with:
|
||||||
# 检测垃圾内容
|
model: 'gpt-4o-mini'
|
||||||
spam-detection: true
|
system-prompt: |
|
||||||
|
你是一个内容审查助手。
|
||||||
# 检测 AI 生成内容
|
检查内容是否包含:
|
||||||
ai-generated-detection: true
|
|
||||||
|
|
||||||
# 自定义提示
|
|
||||||
custom-prompt: |
|
|
||||||
分析这个 issue/评论是否包含:
|
|
||||||
1. 垃圾信息或广告
|
1. 垃圾信息或广告
|
||||||
2. 纯 AI 生成的无意义内容
|
2. 恶意或攻击性内容
|
||||||
3. 恶意或攻击性内容
|
3. 与项目完全无关的内容
|
||||||
4. 与项目无关的内容
|
|
||||||
|
|
||||||
如果是垃圾内容,返回 "SPAM"
|
只返回 "SPAM" 或 "OK",不要其他内容。
|
||||||
如果是正常内容,返回 "OK"
|
prompt: |
|
||||||
|
标题:${{ github.event.issue.title || github.event.comment.body }}
|
||||||
|
|
||||||
# 垃圾内容处理
|
内容:
|
||||||
on-spam:
|
${{ github.event.issue.body || github.event.comment.body }}
|
||||||
labels:
|
|
||||||
- "spam"
|
|
||||||
minimize: true # 隐藏内容
|
|
||||||
comment: |
|
|
||||||
🤖 这个 issue 被 AI 检测为可能的垃圾内容,已自动隐藏。
|
|
||||||
如果这是误判,请联系维护者。
|
|
||||||
|
|
||||||
🤖 This issue was detected as potential spam by AI and has been hidden.
|
- name: Mark as Spam
|
||||||
If this is a false positive, please contact the maintainers.
|
if: contains(steps.check.outputs.response, 'SPAM')
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
// 添加 spam 标签
|
||||||
|
github.rest.issues.addLabels({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
labels: ['spam']
|
||||||
|
});
|
||||||
|
|
||||||
|
// 添加评论
|
||||||
|
github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
body: '🤖 这个内容被 AI 检测为可能的垃圾内容。如果这是误判,请联系维护者。\n\n🤖 This content was detected as potential spam by AI. If this is a false positive, please contact the maintainers.'
|
||||||
|
});
|
||||||
|
|||||||
4
.github/workflows/batch-label-issues.yml
vendored
4
.github/workflows/batch-label-issues.yml
vendored
@@ -146,9 +146,7 @@ jobs:
|
|||||||
gh issue edit $ISSUE_NUM --add-label "$label" 2>&1 | grep -v "already exists" || true
|
gh issue edit $ISSUE_NUM --add-label "$label" 2>&1 | grep -v "already exists" || true
|
||||||
done
|
done
|
||||||
echo " 💬 添加说明评论..."
|
echo " 💬 添加说明评论..."
|
||||||
gh issue comment $ISSUE_NUM --body "🤖 自动标签系统检测到此 issue 并添加了相关标签。如有误判,请告知维护者。
|
gh issue comment $ISSUE_NUM --body $'🤖 自动标签系统检测到此 issue 并添加了相关标签。如有误判,请告知维护者。\n\n🤖 Auto-labeling system detected and labeled this issue. Please let maintainers know if this is incorrect.' || true
|
||||||
|
|
||||||
🤖 Auto-labeling system detected and labeled this issue. Please let maintainers know if this is incorrect." || true
|
|
||||||
else
|
else
|
||||||
echo " ℹ️ 未检测到明确类型"
|
echo " ℹ️ 未检测到明确类型"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user