📦 Cool GitHub Issues - GitHub Issues
v1.0.0Issues Auto-Fix 自动拉取 GitHub Issues,派生子代理实施修复并开启 PR,随后监控并处理 PR 评审意见。 用法:/gh-issues [owner/repo] [--label b...
详细分析 ▾
运行时依赖
版本
自动修复 GitHub issues:生成子代理来实施修复并发起 PR,监控评审评论
安装命令
点击复制技能文档
你是编排者,严格按以下 6 个阶段执行,不得跳过。
重要 — 不依赖 gh CLI,仅用 curl + GitHub REST API。GH_TOKEN 已由 OpenClaw 注入,所有请求在 Header 带:
``
curl -s -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" ...
`
---
阶段 1 — 解析参数
解析 /gh-issues 后的参数字符串。
位置参数:
- owner/repo — 可选。issue 来源仓库;省略时从当前 git remote 检测:
git remote get-url origin
从 URL 提取 owner/repo(支持 HTTPS 与 SSH):
- HTTPS: https://github.com/owner/repo.git → owner/repo
- SSH: git@github.com:owner/repo.git → owner/repo
若不在 git 仓库或无远程,报错并要求手动指定 owner/repo。 标志(均可选):
| 标志 | 默认值 | 说明 |
|------|--------|------|
| --label | 无 | 按标签过滤(如 bug、enhancement) |
| --limit | 10 | 每次轮询最多拉取 issue 数 |
| --milestone | 无 | 按里程碑标题过滤 |
| --assignee | 无 | 按受理人过滤(@me 表示本人) |
| --state | open | issue 状态:open、closed、all |
| --fork | 无 | 你的 fork(user/repo),用于推送分支与发起 PR。issue 仍从源仓库拉取,PR 从 fork 指向源仓库。 |
| --watch | false | 持续轮询新 issue 与 PR 评审 |
| --interval | 5 | 轮询间隔(分钟,仅 --watch 时生效) |
| --dry-run | false | 仅拉取并展示,不派生子代理 |
| --yes | false | 跳过确认,自动处理所有匹配 issue |
| --reviews-only | false | 跳过 issue 处理(阶段 2-5),直接进入阶段 6:检查 open PR 的评审意见并回应。 |
| --cron | false | Cron 模式:拉取 issue 并派生子代理后立即退出,不等待结果。 |
| --model | 无 | 子代理所用模型(如 glm-5、zai/glm-5);未指定则用代理默认模型。 |
| --notify-channel | 无 | Telegram 频道 ID,用于发送最终 PR 摘要(如 -1002381931352),仅发送结果链接,不含过程更新。 |
派生变量:
- SOURCE_REPO = 位置参数 owner/repo(issue 所在仓库)
- PUSH_REPO = 若提供 --fork 则取其值,否则同 SOURCE_REPO
- FORK_MODE = 提供 --fork 时为 true,否则 false
若 --reviews-only: 先执行阶段 2 的 token 解析,然后跳至阶段 6。
若 --cron:
- 强制 --yes(跳过确认)
- 若同时 --reviews-only,先 token 解析再跳至阶段 6(cron 评审模式)
- 否则按 cron 行为继续阶段 2-5
---
阶段 2 — 拉取 Issues
Token 解析:
先确保 GH_TOKEN 存在。
环境检查:
`
echo $GH_TOKEN
`
若空,读取配置:
`
CONFIG_PATH="${OPENCLAW_CONFIG_PATH:-${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/openclaw.json}"
cat "$CONFIG_PATH" | jq -r '.skills.entries["gh-issues"].apiKey // empty'
`
仍空则检查:
`
cat /data/.clawdbot/openclaw.json | jq -r '.skills.entries["gh-issues"].apiKey // empty'
`
导出:
`
export GH_TOKEN=""
` 执行 curl 拉取:
`
curl -s -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/{SOURCE_REPO}/issues?per_page={limit}&state={state}&{query_params}"
``
其中 {query_params} 由以下构建:
- 若 --label,加 labels={label}
- 若 --milestone,先 GET /repos/{SOURCE_REPO}/milestones 按标题匹配得到 milestone number,再加 milestone={number}
- 若 --assignee,值为 @me 时先 GET /user 解析自身登录名,再加 assignee={assignee}