.pi/skills/approve-pr/SKILL.md
Approve the pull request for the branch that is currently checked out. This skill
is meant to be run right after review-pr in the same conversation: it takes
the review you just produced and posts it as an approving review. Do not
re-review here — post the existing review.
Actions performed, in order:
QUEUED FOR MERGE label.Only approve if the most recent review-pr report in this conversation has a
verdict of approve with ZERO open Critical findings and ZERO open
correctness / performance / IO / resource findings (per the review-pr
correctness & performance gate). If any such finding is still open, do NOT
approve — tell the user the PR does not meet the bar and suggest reject-pr.
/skill:review-pr first — do not approve unreviewed code.Auto-detect the PR from the checked-out branch. An explicit PR number/URL in the arguments overrides detection.
PR='<explicit PR number/URL from arguments, else empty>'
[ -z "$PR" ] && PR=$(gh pr view --json number -q .number 2>/dev/null)
if [ -z "$PR" ]; then
echo "No PR found for the current branch. Run 'gh pr checkout <n>' or pass a PR number."; exit 1
fi
gh pr view "$PR" --json number,title,author,headRefName,url,state,labels
echo "Approving PR #$PR"
State one line to the user: which PR (#number — title) you are about to approve,
then proceed.
Write the review body to /tmp/approve-pr-$PR.md using the write tool (never
inline it into a shell command — reviews contain backticks, quotes, and $ that
break shell quoting). The body is the full verbatim review-pr report.
gh pr review "$PR" --approve --body-file /tmp/approve-pr-$PR.md
gh pr edit "$PR" --add-label "QUEUED FOR MERGE"
Notes:
gh pr review --approve
fails for that reason, fall back to
gh pr comment "$PR" --body-file /tmp/approve-pr-$PR.md, tell the user the PR
could not be formally approved because it is self-authored, and still add the
QUEUED FOR MERGE label.Report back in one or two lines:
QUEUED FOR MERGE label was added.