Community编程与开发github.com

gh-issues

从 GitHub Issues 自动创建 Pull Request,支持问题筛选、后台修复代理、PR 提交及审查评论处理。

gh-issues 是什么?

gh-issues 是一款面向 AI Agent 的 GitHub Issue 到 PR 的自动化技能。它通过 `gh` CLI(可选)或 `gh api` 获取 Issue 列表,并根据标签、里程碑、指派人等条件进行过滤。用户确认后,该技能会启动最多 8 个后台工作进程,每个进程独立完成分支创建、代码修复、测试、提交和 PR 创建,并自动在 PR 正文中附加问题描述和修复证据。技能还支持 PR 审查评论的自动处理(`--reviews-only`),可解析、分组评论并生成修复提交。配合 `--watch` 和 `--cron` 模式可实现持续轮询和无人值守运行。支持 fork 模式以保护主仓库分支,并提供防重复工作(基于 open PR 和 claim 文件)与通知渠道集成。工作流的每个阶段都有清晰的 bash 命令示例,适合 Claude Code、Codex 等支持技能定义的系统。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/gh-issues

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

gh-issues 是做什么的?

用于 Issue 到 PR 的自动化。优先使用 gh CLI;仅当高层命令缺少所需字段时回退到 gh api。

参数

  • 位置参数 owner/repo:可选;否则从 git remote get-url origin 推断。
  • --label <label>:过滤。
  • --limit <n>:默认为 10。
  • --milestone <title>:过滤。
  • --assignee <login|@me>:过滤。
  • --state open|closed|all:默认为开放。
  • --fork <owner/repo>:将分支推送到 fork,PR 提交到源仓库。
  • --watch:轮询 Issue 和审查。
  • --interval <分钟>:默认为 5。
  • --dry-run:只列出。
  • --yes:无需确认。
  • --reviews-only:跳过 Issue 修复;处理 PR 审查。
  • --cron:生成并退出;隐含 --yes。
  • --model <id>:在受支持时传递给工作进程。
  • --notify-channel <id>:可选的通知目标。

阶段 1:解析仓库

git remote get-url origin
if [ -z "${GH_TOKEN:-}" ]; then
  CONFIG_PATH="${OPENCLAW_CONFIG_PATH:-${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/openclaw.json}"
  GH_TOKEN=$(jq -r '.skills.entries["gh-issues"].apiKey // empty' "$CONFIG_PATH" 2>/dev/null || true)
  if [ -n "$GH_TOKEN" ]; then export GH_TOKEN; fi
fi
gh auth status
gh repo view OWNER/REPO --json nameWithOwner,defaultBranchRef

如果 gh auth status 失败且缺少 GH_TOKEN,则停止并询问 GitHub 认证/配置。

衍生:

  • SOURCE_REPO:Issue 仓库。
  • PUSH_REPO:如果设置了 fork,则为 fork,否则为源仓库。
  • BASE_BRANCH:除非用户另有说明,否则为源仓库的默认分支。
  • PUSH_REMOTE:在 fork 模式下为 fork,否则为 origin。

如果工作树不干净,除非用户确认工作进程应忽略未提交的更改,否则停止。

在 fork 模式下,在确认之前或 --dry-run 期间,请勿修改远程仓库。

仅验证认证/读取访问:

gh auth token >/dev/null || test -n "${GH_TOKEN:-}"
gh repo view "$PUSH_REPO" --json nameWithOwner
git ls-remote --exit-code origin HEAD

阶段 2:获取 Issue

构建过滤器并获取:

gh issue list --repo "$SOURCE_REPO" --state open --limit 10 --json number,title,labels,url,body,assignees,milestone

按需添加 --label、--milestone、--assignee、--state、--limit 参数。gh issue list 已经排除了 PR。

如果未找到,报告无匹配。如果为 --dry-run,则显示紧凑列表并停止。

阶段 3:避免重复工作

对于每个候选:

gh pr list --repo "$SOURCE_REPO" --search "$SOURCE_REPO#<n>" --state open --json number,url,title,headRefName
gh pr list --repo "$SOURCE_REPO" --head "fix/issue-<n>" --state open --json number,url
gh api "repos/$PUSH_REPO/branches/fix/issue-<n>" >/dev/null

跳过存在开放 PR、已有分支或活跃本地声明的候选。

声明文件:

${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/gh-issues-<owner>-<repo>.json

过期超过 2 小时的声明。在写入前创建父目录。

阶段 4:确认

除非指定了 --yes 或 --cron,否则要求用户选择:

  • all
  • 逗号分隔的问题编号
  • cancel

确认后,在 fork 模式下,在将工作交给代理之前配置推送远程:

gh auth setup-git
git remote get-url fork || git remote add fork "https://github.com/$PUSH_REPO.git"
git remote set-url fork "https://github.com/$PUSH_REPO.git"
git ls-remote --exit-code fork HEAD

阶段 5:生成工作进程

启动最多 8 个后台工作进程。在 --cron 模式下,不要阻塞等待每个工作进程。

在每次生成之前,使用当前 ISO 时间戳为 SOURCE_REPO#<n> 写入声明。在工作进程报告 PR 或失败后,删除或更新声明。这可以防止在分支或 PR 存在之前出现轮询/cron 重叠。

工作进程提示必须包含:

  • Issue URL、标题、正文、标签
  • SOURCE_REPO、PUSH_REPO、BASE_BRANCH、PUSH_REMOTE、fork 模式
  • 目标分支 fix/issue-<n>
  • 所需的证据和 PR 正文
  • 通知路由

工作进程指令:

使用 gh 和 git。不要含糊其辞。
从 BASE_BRANCH 检出/创建 fix/issue-<n>。
实现最小的修复。
运行相关测试。
使用常规提交消息提交。
推送到 PUSH_REMOTE。
打开针对 SOURCE_REPO BASE_BRANCH 的 PR。
PR 正文:解决的问题 + 做出更改的原因 + 用户影响 + 证据 + 可见的修复 修复 #<n>。
报告 PR URL 或失败原因。
如果提供了路由,使用 openclaw message send 发送完成/失败消息。

在可用时使用 coding-agent 启动规则。

阶段 6:收集

使用 process 或任务注册表轮询工作进程。报告:

  • Issue 编号 + 标题
  • 状态:PR 已打开、已跳过、已失败、已超时
  • PR URL 或原因

仅使用最终紧凑摘要通知频道。

仅审查 / 观察审查

发现开放的 PR:

gh pr list --repo "$SOURCE_REPO" --state open --json number,title,url,headRefName,reviewDecision \
  --jq '[.[] | select(.headRefName | startswith("fix/issue-"))]'

获取审查线程/评论:

gh pr view <n> --repo "$SOURCE_REPO" --json url,headRefName,comments,reviews
gh api "repos/$SOURCE_REPO/pulls/<n>/comments"
gh api "repos/$SOURCE_REPO/issues/<n>/comments"

仅处理由本工作流创建的 fix/issue-* PR,除非用户显式指定了 PR 编号。按 PR 对可操作的评论进行分组。忽略赞美、状态、重复和已处理的评论。为每个选定/限定范围的 PR 生成一个工作进程,使用相同的后台规则。

审查工作进程指令:

检出 PR 分支。
阅读所有可操作的审查评论。
应用最小更改。
运行相关测试。
正常提交并推送;除非明确指示,否则不要强制推送。
回复已处理的评论,附带修复和提交/文件引用。
报告已处理/已跳过的评论及证据。

观察模式

循环:

  1. 获取 Issue。
  2. 生成符合条件的 Issue 工作进程。
  3. 处理可操作的 PR 审查。
  4. 睡眠 --interval。
  5. 用户要求停止时停止。

保持累计摘要简洁。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

相关技能