Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
214 lines
6.2 KiB
Markdown
214 lines
6.2 KiB
Markdown
---
|
|
name: gh-issues
|
|
description: "Fetch GitHub issues, select candidates, spawn background fix agents, open PRs, and optionally process PR review comments."
|
|
user-invocable: true
|
|
metadata:
|
|
{
|
|
"openclaw":
|
|
{
|
|
"requires": { "bins": ["git", "gh"] },
|
|
"primaryEnv": "GH_TOKEN",
|
|
"install":
|
|
[
|
|
{
|
|
"id": "brew",
|
|
"kind": "brew",
|
|
"formula": "gh",
|
|
"bins": ["gh"],
|
|
"label": "Install GitHub CLI (brew)",
|
|
},
|
|
],
|
|
},
|
|
}
|
|
---
|
|
|
|
# gh-issues
|
|
|
|
Use for issue-to-PR automation. Prefer `gh` CLI; fall back to `gh api` only when a high-level command lacks the needed field.
|
|
|
|
## Arguments
|
|
|
|
- positional `owner/repo`: optional; else infer from `git remote get-url origin`.
|
|
- `--label <label>`: filter.
|
|
- `--limit <n>`: default 10.
|
|
- `--milestone <title>`: filter.
|
|
- `--assignee <login|@me>`: filter.
|
|
- `--state open|closed|all`: default open.
|
|
- `--fork <owner/repo>`: push branches to fork, PR to source.
|
|
- `--watch`: poll issues + reviews.
|
|
- `--interval <minutes>`: default 5.
|
|
- `--dry-run`: list only.
|
|
- `--yes`: no confirmation.
|
|
- `--reviews-only`: skip issue fixing; handle PR reviews.
|
|
- `--cron`: spawn and exit; implies `--yes`.
|
|
- `--model <id>`: pass to workers when supported.
|
|
- `--notify-channel <id>`: optional final notification target.
|
|
|
|
## Phase 1: resolve repo
|
|
|
|
```bash
|
|
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
|
|
```
|
|
|
|
If `gh auth status` fails and `GH_TOKEN` is missing, stop and ask for GitHub auth/config.
|
|
|
|
Derived:
|
|
|
|
- `SOURCE_REPO`: issue repo.
|
|
- `PUSH_REPO`: fork if set, else source.
|
|
- `BASE_BRANCH`: source default branch unless user says otherwise.
|
|
- `PUSH_REMOTE`: `fork` in fork mode, else `origin`.
|
|
|
|
Stop on dirty worktree unless user confirms that workers should ignore uncommitted changes.
|
|
|
|
In fork mode, do not mutate remotes before confirmation or during `--dry-run`.
|
|
|
|
Verify auth/read access only:
|
|
|
|
```bash
|
|
gh auth token >/dev/null || test -n "${GH_TOKEN:-}"
|
|
gh repo view "$PUSH_REPO" --json nameWithOwner
|
|
git ls-remote --exit-code origin HEAD
|
|
```
|
|
|
|
## Phase 2: fetch issues
|
|
|
|
Build filters and fetch:
|
|
|
|
```bash
|
|
gh issue list --repo "$SOURCE_REPO" --state open --limit 10 --json number,title,labels,url,body,assignees,milestone
|
|
```
|
|
|
|
Add `--label`, `--milestone`, `--assignee`, `--state`, `--limit` as requested. `gh issue list` already excludes PRs.
|
|
|
|
If none found: report no matches. If `--dry-run`: show compact list and stop.
|
|
|
|
## Phase 3: avoid duplicate work
|
|
|
|
For each candidate:
|
|
|
|
```bash
|
|
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
|
|
```
|
|
|
|
Skip candidates with an open PR, existing branch, or active local claim.
|
|
|
|
Claim file:
|
|
|
|
```text
|
|
${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/gh-issues-<owner>-<repo>.json
|
|
```
|
|
|
|
Expire claims older than 2 hours.
|
|
Create the parent directory before writing.
|
|
|
|
## Phase 4: confirm
|
|
|
|
Unless `--yes` or `--cron`, ask user to choose:
|
|
|
|
- `all`
|
|
- comma-separated issue numbers
|
|
- `cancel`
|
|
|
|
After confirmation, in fork mode, configure the push remote before handing work to agents:
|
|
|
|
```bash
|
|
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
|
|
```
|
|
|
|
## Phase 5: spawn workers
|
|
|
|
Launch up to 8 background workers. Do not block on each worker when `--cron`.
|
|
|
|
Before each spawn, write a claim for `SOURCE_REPO#<n>` with the current ISO timestamp. After a worker reports PR/failure, remove or update the claim. This prevents watch/cron overlap before a branch or PR exists.
|
|
|
|
Worker prompt must include:
|
|
|
|
- issue URL, title, body, labels.
|
|
- `SOURCE_REPO`, `PUSH_REPO`, `BASE_BRANCH`, `PUSH_REMOTE`, fork mode.
|
|
- target branch `fix/issue-<n>`.
|
|
- required proof and PR body.
|
|
- notification route.
|
|
|
|
Worker instructions:
|
|
|
|
```text
|
|
Use gh and git. Do not handwave.
|
|
Checkout/create fix/issue-<n> from BASE_BRANCH.
|
|
Implement minimal fix.
|
|
Run relevant tests.
|
|
Commit with conventional message.
|
|
Push to PUSH_REMOTE.
|
|
Open PR against SOURCE_REPO BASE_BRANCH.
|
|
PR body: What Problem This Solves + Why This Change Was Made + User Impact + Evidence + visible Fixes SOURCE_REPO#<n>.
|
|
Report PR URL or failure reason.
|
|
Send completion/failure with openclaw message send if route provided.
|
|
```
|
|
|
|
Use `coding-agent` launch rules when available.
|
|
|
|
## Phase 6: collect
|
|
|
|
Poll workers with `process` or task registry. Report:
|
|
|
|
- issue number + title.
|
|
- status: PR opened, skipped, failed, timed out.
|
|
- PR URL or reason.
|
|
|
|
Notify channel only with final compact summary.
|
|
|
|
## Reviews-only / watch reviews
|
|
|
|
Discover open PRs:
|
|
|
|
```bash
|
|
gh pr list --repo "$SOURCE_REPO" --state open --json number,title,url,headRefName,reviewDecision \
|
|
--jq '[.[] | select(.headRefName | startswith("fix/issue-"))]'
|
|
```
|
|
|
|
Fetch review threads/comments:
|
|
|
|
```bash
|
|
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"
|
|
```
|
|
|
|
Only process `fix/issue-*` PRs created by this workflow unless the user explicitly named PR numbers. Group actionable comments by PR. Ignore praise, status, duplicates, and already-addressed comments. Spawn one worker per selected/scoped PR, same background rules.
|
|
|
|
Review worker instructions:
|
|
|
|
```text
|
|
Checkout PR branch.
|
|
Read all actionable review comments.
|
|
Patch minimal changes.
|
|
Run relevant tests.
|
|
Commit and push normally; do not force-push unless explicitly told.
|
|
Reply to addressed comments with fix + commit/file reference.
|
|
Report comments addressed/skipped and proof.
|
|
```
|
|
|
|
## Watch mode
|
|
|
|
Loop:
|
|
|
|
1. Fetch issues.
|
|
2. Spawn eligible issue workers.
|
|
3. Process actionable PR reviews.
|
|
4. Sleep `--interval`.
|
|
5. Stop when user says stop.
|
|
|
|
Keep cumulative summary small.
|