From github-workflows
Automatically finalize pull requests for merge by resolving CodeQL violations, review threads, merge conflicts, and CI failures. Handles single PR (current branch or by number), all open PRs in the repo, or all open PRs across the org. Includes bot-authored PRs in all modes.
npx claudepluginhub jacobpevans/claude-code-plugins --plugin github-workflowsThis skill uses the workspace's default tool permissions.
<!-- cspell:words worktree oneline -->
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
FULLY AUTOMATIC - Fully automates PR finalization: monitor, fix, prepare for merge. Assumes PR already exists.
No manual intervention required. For manual review-focused workflows, use /review-pr.
/resolve-pr-threads for review threads/resolve-codeql/ship.Steps 1.1–1.4 run sequentially.
| Argument | Mode | Target |
|---|---|---|
| (none) | Current branch | Single PR on current branch |
42 | Single PR | PR #42 |
all | Repo-wide | All open PRs in current repo |
org | Org-wide | All open PRs across all repos in current org |
all): List all open PRs (limit 50) with number, title, author, headRefName.org): Enumerate repos, list open PRs per repo (limit 50 each, 50 total cap), include repository field.Tag PRs where author.login ends with [bot] for reporting. Process identically to human PRs.
Display discovery list before proceeding. Verify working tree is clean (if dirty, ask user to commit/stash). Note current branch for restoration.
If invoked via /ship, a context brief is already in session context — skip this step.
If invoked standalone, build a lightweight brief from:
gh pr view {number} --json body --jq '.body'BASE=$(gh pr view {number} --json baseRefName --jq '.baseRefName') && git log --oneline origin/$BASE..HEADSynthesize purpose, key changes, and intentional patterns into a 5-10 line block.
This informs /resolve-pr-threads (Phase 2.2) when evaluating reviewer feedback.
Execution strategy: Start CI monitoring in the background (Step 2.1) and
fix all other issues in parallel while CI runs. Never block on CI when other
work is available. Pre-push simplification is handled by /ship; within this
skill, /simplify runs once at Step 2.3.5 after all fixes are applied.
For multi-PR modes, Phases 2-5 execute once per PR in sequence. Check out each PR branch at the
start of each iteration. For org-wide mode, use repository.nameWithOwner from Phase 1 as the
--repo argument when checking out.
Steps 2.1 and 2.2 start concurrently (2.1 is non-blocking). Steps 2.3 and 2.4 run sequentially after 2.2.
Launch CI monitoring in a background Task agent (run_in_background: true on the Task tool).
Monitor CI checks using --watch so the agent blocks until all complete.
Do NOT wait for the agent to finish — proceed to 2.2 immediately.
Run these checks simultaneously. Launch independent fixes in parallel via
Task agents when they touch different files. Invoke superpowers:dispatching-parallel-agents for dispatch patterns.
Check for open code-scanning alerts:
gh api repos/${OWNER}/${REPO}/code-scanning/alerts --paginate \
--jq '[.[] | select(.state == "open")] | length'
If violations found: Invoke /resolve-codeql fix, validate locally.
Invoke /resolve-pr-threads. It exits cleanly when no threads exist.
After completion, validate locally.
Check if the PR is mergeable. If conflicts: Fetch main, attempt merge, report unresolvable conflicts for user. After resolution, validate locally.
Check background CI results from 2.1:
After all fixes from 2.2 and 2.3 are complete, invoke /simplify once on all
cumulative changes. This is the single /simplify pass within /finalize-pr —
it catches any code introduced by fix iterations (CodeQL fixes, CI fixes,
review thread implementations) that wasn't part of the original pre-push
simplification. If /simplify produces changes, validate locally, commit,
and push before proceeding to 2.4.
Verify final PR state, mergeability, and check status. If fixes introduced new issues, loop back to 2.2.
Verify ALL conditions automatically and proceed directly:
gh api repos/{owner}/{repo}/code-scanning/alertsgh pr checks <PR> all greenOnly if ALL six pass: Proceed to Phase 4 to update PR metadata.
Multi-PR handling: If a PR needs human intervention (unresolvable conflict, unrecoverable CI failure, etc.), log it with reason and continue to the next PR. Do not stop the batch for one blocked PR.
Delegate to a haiku subagent to keep full diff out of main context. Steps 4.1 and 4.2 run sequentially within the agent. Step 4.3 runs after both.
Closes #X (directly related issues) or Related: #X (adjacent PRs) — no guessing.After 4.1 and 4.2 complete, write the body to a temp file and apply with gh pr edit --body-file
(safer than inline for multiline content).
Proceed to Phase 5.
Single/current-branch mode: Report ready status and wait for user:
✅ PR #{NUMBER} ready for final review!
All checks passed and PR metadata is up to date.
IMPORTANT: Do NOT merge this PR. Wait for the human to review and invoke
/squash-merge-pr # Squash all commits into one
/rebase-pr # Rebase commits onto main (preserves history)
Multi-PR mode: Record the per-PR result (ready / blocked / needs-human). Restore the original branch and continue to the next PR. Do NOT emit a ready report — that happens in Phase 6.
MUST NOT return until ALL conditions pass for EVERY targeted PR: CI green, CodeQL clean, threads resolved, no conflicts, code simplified, local linters and tests pass, metadata updated. If ANY fails, loop back to Phase 2. CRITICAL: CodeQL is SEPARATE from CI — check both independently.
MERGE PROHIBITION: FORBIDDEN from merging, auto-merging, enabling auto-merge, or approving any PR.
After processing all PRs, emit a summary listing ready PRs with merge commands
and blocked PRs with reasons. For org-wide mode, include --repo on merge
commands. Wait for explicit user merge commands.
Use ONLY after a PR exists. Phases: 1 (discover) → 1.5 (context brief) →
2 (fix loop) → 3 (verify) → 4 (metadata) → 5 (report ready).
For all/org modes: Phases 2-5 loop per PR, Phase 6 aggregates results.