Community程式設計與開發github.com

gh-issues

自動從 GitHub Issues 挑選問題、生成修復分支、發起 Pull Request,並可選擇處理 PR 審查意見。

gh-issues 是什麼?

這個技能旨在實現從 GitHub Issue 到 Pull Request 的全自動化流程。它能自動抓取指定倉庫中的 Issues,根據標籤、里程碑、指派者等條件進行篩選,並避免重複處理已存在分支或 PR 的 Issue。使用者可以透過互動式選擇或自動模式(--yes/--cron)來決定要處理哪些 Issue。技能會為每個選定的 Issue 啟動背景修復 Agent,這些 Agent 會基於基礎分支建立修復分支、實作最小修復、執行測試、提交並推送程式碼,最後建立帶有完整說明的 Pull Request。此外,它也支援處理由相同工作流程建立的 PR 審查意見,以及透過監控模式(--watch)持續輪詢新的 Issue 和 PR 審查。此技能主要依賴 `gh` CLI 與 GitHub API 進行互動,支援 fork 模式,並可透過環境變數或設定檔進行認證。

相容平台~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:預設值為 open。
  • --fork <owner/repo>:將分支推送到 fork,並向來源倉庫發起 PR。
  • --watch:輪詢 Issue 與審查意見。
  • --interval <minutes>:預設值為 5。
  • --dry-run:僅列出,不執行實際操作。
  • --yes:不進行確認。
  • --reviews-only:跳過 Issue 修復;僅處理 PR 審查。
  • --cron:啟動後即退出;隱含 --yes。
  • --model <id>:在支援的情況下傳遞給工作 Agent。
  • --notify-channel <id>:可選的最終通知目標。

第一階段:解析倉庫

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。

若工作目錄有未提交的變更則停止,除非使用者確認工作 Agent 應忽略未提交的變更。

在 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

第二階段:擷取 Issues

建立篩選條件並擷取:

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。

如果未找到任何 Issue:回報無符合項目。如果使用了 --dry-run:顯示簡潔列表並停止。

第三階段:避免重複作業

對每個候選 Issue:

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、現有分支或本地活躍聲明的候選 Issue。

聲明檔:

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

超過 2 小時的聲明視為過期。在寫入前先建立父目錄。

第四階段:確認

除非指定了 --yes 或 --cron,否則要求使用者選擇:

  • all
  • 以逗號分隔的 Issue 編號
  • cancel

確認後,在 fork 模式下,在將工作交給 Agent 前設定推送遠端:

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

第五階段:產生工作 Agent

最多啟動 8 個背景工作 Agent。在 --cron 模式下,不要在每個 Agent 上阻塞等待。

在每個 Agent 啟動前,為 SOURCE_REPO#<n> 寫入一個帶有當前 ISO 時間戳的聲明。在 Agent 回報 PR 或失敗後,移除或更新該聲明。這可以防止在分支或 PR 建立前,監控/cron 模式重複處理。

工作 Agent 提示必須包含:

  • Issue 網址、標題、內容、標籤。
  • SOURCE_REPO、PUSH_REPO、BASE_BRANCH、PUSH_REMOTE、fork 模式。
  • 目標分支 fix/issue-<n>。
  • 所需的證明與 PR 內容。
  • 通知路徑。

工作 Agent 指示:

使用 gh 和 git。不要含糊帶過。
從 BASE_BRANCH 簽出/建立 fix/issue-<n> 分支。
實作最小修復。
執行相關測試。
使用 conventional commit 格式提交。
推送到 PUSH_REMOTE。
向 SOURCE_REPO 的 BASE_BRANCH 發起 PR。
PR 內容:此問題解決了什麼 + 為何進行此變更 + 使用者影響 + 證據 + 視覺 fix SOURCE_REPO#<n>。
回報 PR 網址或失敗原因。
如果提供了通知路徑,使用 openclaw message send 發送完成/失敗訊息。

在支援的情況下,使用 coding-agent 啟動規則。

第六階段:收集結果

透過 process 或任務註冊表輪詢工作 Agent。回報:

  • Issue 編號 + 標題。
  • 狀態:PR 已開啟、已跳過、已失敗、逾時。
  • PR 網址或原因。

僅在通知頻道發送最終的簡潔摘要。

僅處理審查 / 監控審查

發現開啟的 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"

除非使用者明確指定 PR 編號,否則僅處理由此工作流程建立的 fix/issue-* PR。按 PR 分組可操作的評論。忽略讚美、狀態訊息、重複及已處理的評論。對每個選定的 PR/範圍啟動一個工作 Agent,使用相同的背景規則。

審查工作 Agent 指示:

簽出 PR 分支。
閱讀所有可操作的審查評論。
修補最小的變更。
執行相關測試。
正常提交並推送;除非明確指示,否則不要 force push。
回覆已處理的評論,並附上修復內容及 commit/檔案參考。
回報已處理/跳過的評論數量及證明。

監控模式

循環:

  1. 擷取 Issues。
  2. 為符合條件的 Issue 啟動工作 Agent。
  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.

相關技能