
Ship Pr
Run the exact gh CLI and GraphQL commands to inspect PR state, review threads, checks, and ship a merge-ready pull request.
Overview
Ship PR is an agent skill for the Ship phase that provides exact GitHub CLI and GraphQL commands to assess, discuss, and merge pull requests.
Install
npx skills add https://github.com/blackhole1/bh-skills --skill ship-prWhat is this skill?
- Resolves OWNER, REPO, and PR via gh repo view and gh pr view JSON queries
- One-shot PR snapshot via scripts/pr-state.sh with raw fallbacks for checks and merge state
- Documents mergeable, mergeStateStatus (CLEAN, BLOCKED, UNSTABLE, DIRTY, BEHIND), and reviewDecision fields
- GraphQL recipe for review threads with bodies, authors, resolution, and comment databaseId for replies
- Cookbook-style exact commands—no hand-wavy git steps
- reviewThreads(first:100) GraphQL pagination cap in documented query
Adoption & trust: 1 installs on skills.sh; 4 GitHub stars; trending (+100% hot-view momentum).
What problem does it solve?
You know the PR should merge but keep re-deriving gh flags, merge state meanings, and how to fetch review thread IDs for replies.
Who is it for?
Builders using gh on a single repo who want agent-driven PR triage, check interpretation, and review-thread replies.
Skip if: Teams not on GitHub, greenfield repos without gh auth, or workflows that need full CI authoring instead of reading existing check status.
When should I use this skill?
When the agent needs to resolve, assess, or merge the current branch’s GitHub pull request using gh.
What do I get? / Deliverables
You have a deterministic command sequence for PR target resolution, state assessment, and review-thread access so the agent can drive merge readiness without improvising shell.
- PR state JSON snapshot
- Interpreted check and merge readiness
- Review thread data for targeted replies
Recommended Skills
Journey fit
How it compares
Command reference for gh ship operations—not a code review rubric skill and not a hosted CI platform integration.
Common Questions / FAQ
Who is ship-pr for?
Solo and indie developers who merge via GitHub PRs and want their coding agent to run vetted gh and GraphQL steps.
When should I use ship-pr?
During Ship when a branch PR needs check interpretation, conflict/BEHIND diagnosis, or structured reads of unresolved review threads before merge.
Is ship-pr safe to install?
It instructs network and git/gh operations against your authenticated GitHub account; review the Security Audits panel on this Prism page and scope repo access appropriately.
SKILL.md
READMESKILL.md - Ship Pr
# gh cookbook for ship-pr Exact commands for each operation. `OWNER`, `REPO`, and `PR` are placeholders; derive the first two with `gh repo view --json owner,name` and pin `PR` once. ## Resolve the target ```bash PR=$(gh pr view --json number -q .number) # current branch's PR read OWNER REPO < <(gh repo view --json owner,name -q '.owner.login+" "+.name') gh pr view "$PR" --json number,url,state,headRefName,baseRefName,isDraft ``` ## Assess state Prefer `scripts/pr-state.sh "$PR"` for a one-shot JSON snapshot. Raw pieces: ```bash gh pr checks "$PR" --json name,bucket,state # bucket: pass|fail|pending|skipping|cancel gh pr view "$PR" --json mergeable,mergeStateStatus,reviewDecision,state ``` - `mergeable`: `MERGEABLE` | `CONFLICTING` | `UNKNOWN`. - `mergeStateStatus`: `CLEAN` (mergeable, checks done) | `BLOCKED` | `UNSTABLE` (a non-required/ pending check) | `DIRTY` (conflicts) | `BEHIND`. ## Read review threads (with bodies, authors, resolution, reply ids) Review threads live in the GraphQL API. This returns each thread's resolution state plus every comment's `databaseId` (the REST id you reply to): ```bash gh api graphql -F owner="$OWNER" -F repo="$REPO" -F pr="$PR" -f query=' query($owner:String!,$repo:String!,$pr:Int!){ repository(owner:$owner,name:$repo){ pullRequest(number:$pr){ reviewThreads(first:100){nodes{ isResolved isOutdated path line comments(first:50){nodes{ databaseId author{login} body }} }} } } }' ``` The flat REST list of review (line) comments is handy too: ```bash gh api "repos/$OWNER/$REPO/pulls/$PR/comments" \ --jq '.[] | {id, user: .user.login, path, line, body}' ``` The reviewer bot's PR-level summary is an *issue* comment, not a review comment: ```bash gh api "repos/$OWNER/$REPO/issues/$PR/comments" \ --jq '.[] | select(.user.login|test("coderabbit";"i")) | .body' ``` ## Reply to a review comment (dispute a false positive) Reply *inside the thread* by posting a reply to the thread's first comment id (`COMMENT_ID` = a `databaseId` from the GraphQL query above): ```bash gh api "repos/$OWNER/$REPO/pulls/$PR/comments/$COMMENT_ID/replies" \ -f body="@coderabbitai This is intentional: <concise technical reason>." ``` Addressing CodeRabbit directly with `@coderabbitai` makes it respond and, if it agrees, resolve the thread. For a general (non-thread) note use `gh pr comment "$PR" --body "..."`. ## Do NOT resolve threads Resolving is `resolveReviewThread` (GraphQL). This skill deliberately never calls it — the reviewer resolves its own threads after seeing your fix or reply. Listed here only so it's recognizable and explicitly avoided. ## Fix → push from the isolated worktree (re-triggers CI + re-review) Never edit the user's checkout. Work in the worktree synced to the PR head: ```bash wt=$(scripts/pr-worktree.sh ensure "$PR") # detached worktree at the PR head # edit files under "$wt", run the project's own checks THERE, then: git -C "$wt" commit -s -am "fix(scope): address review — <what>" git -C "$wt" push origin HEAD:<headRefName> # same-repo PR; never --force # fork PR — push to the fork instead (needs write access to it): # git -C "$wt" push https://github.com/<headOwner>/<headRepo>.git HEAD:<headRefName> scripts/pr-worktree.sh remove "$PR" # after the PR is merged ``` Resolve `<headRefName>` and whether it's a fork: ```bash gh pr view "$PR" --json headRefName,isCrossRepository,headRepositoryOwner,headRepository ``` ## Re-run a failing job (suspected flake) ```bash gh run list --branch "$(gh pr view "$PR" --json headRefName -q .headRefName)" --limit 5 gh run rerun <run-id> --failed ``` ## Merge ```bash gh pr merge "$PR" --squash --delete-branch \ --subject "<PR title> (#$PR)" \ --body "<short rationale; keep a Signed-off-by line if the repo uses DCO>" ``` Use `--merge` or `--rebase` instead of `--squash` only if that matches the repo's history convention. Confirm the strategy is e