approve-pr
This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.
Context
Repository: !gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || echo "unknown"
Default branch: !git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@refs/remotes/origin/@@' || echo main
Current branch: !git branch --show-current 2>/dev/null
My login: !gh api user --jq .login 2>/dev/null || echo "unknown"
Instructions
Review a GitHub PR as a maintainer and, when it earns it, post the single GitHub approval; otherwise report and decline. Auto-post only the approval; non-approving writes need an explicit opt-in. Execute immediately without asking.
Delegate the approve-or-decline verdict to verify-pr (consume its recommendation), the unresolved-thread triage to verify-pr-comments, the review body to summarize-review when your own commits are on the PR, and the optional post-approval merge to ship-pr (it owns the merge gate and the merge, and validates the merge method). Own only the self-approval guard, the verdict-to-action mapping, and the gh pr review write. Invoke the others by name and act on their output; never inline or reimplement their logic.
Process
-
Parse the PR and flags. The leading positional of
$ARGUMENTSis a PR number (e.g.4621) or a full PR URL; flags follow. The default with no flag is approve-only.--mergehands the PR toship-prafter a successful approval, forwarding any pass-through merge flags (--squash,--admin,--delete-branch) to it unvalidated;--request-changesand--commentopt into a non-approving write. Derive OWNER and REPO from the Repository probe. -
Fetch PR state and run the self-approval guard. Read
gh pr view <n> --repo <o>/<r> --json number,author,headRefOid,state,reviewDecision. Ifstateis notOPEN, report and stop. Self-approval guard (owned): ifauthor.loginequals the My login probe, stop before any write. GitHub rejects approving your own PR (Can not approve your own pull request), so report that it needs a different maintainer, or/ship-pr <n>to drive your own change to merge while it waits for someone else's approval. RecordheadRefOidfor the stale-head recheck in step 5.