|
| 1 | +--- |
| 2 | +name: approve-pr |
| 3 | +description: Approve the pull request for the currently checked-out branch. Posts the review from this conversation as an approving review and adds the "QUEUED FOR MERGE" label. Use after review-pr when you decide to approve. |
| 4 | +allowed-tools: bash read write |
| 5 | +metadata: |
| 6 | + argument-hint: "[optional PR number or URL to override auto-detection]" |
| 7 | +--- |
| 8 | + |
| 9 | +# Approve a QuestDB client pull request |
| 10 | + |
| 11 | +Approve the pull request for the branch that is currently checked out. This skill |
| 12 | +is meant to be run **right after `review-pr`** in the same conversation: it takes |
| 13 | +the review you just produced and posts it as an approving review. Do not |
| 14 | +re-review here — post the existing review. |
| 15 | + |
| 16 | +This repo (`java-questdb-client`) is a submodule of `questdb`. Approving the |
| 17 | +client PR does not approve any tandem PR — if the review required a tandem OSS or |
| 18 | +Enterprise PR (see the review-pr Step 2.7 gate), that PR must be approved |
| 19 | +separately in its own repo. |
| 20 | + |
| 21 | +Actions performed, in order: |
| 22 | +1. Post the review as the PR's review body (this is the "PR comment"). |
| 23 | +2. Approve the PR. |
| 24 | +3. Add the `QUEUED FOR MERGE` label (creating it if this repo does not have it yet). |
| 25 | + |
| 26 | +## Step 0: Confirm the review actually clears the bar |
| 27 | + |
| 28 | +Only approve if the most recent `review-pr` report in this conversation has a |
| 29 | +verdict of **approve** with, per the review-pr Step 4 gates: |
| 30 | +- ZERO open Critical findings, and zero open correctness / concurrency / |
| 31 | + resource findings; |
| 32 | +- the **Zero-GC gate** satisfied — no open steady-state (per-row / per-producer-call) |
| 33 | + allocation or reachable algorithmic inefficiency on the ingestion path; |
| 34 | +- the **Test & tandem gate** satisfied — no UNTESTED Critical rows in the Step 2.6 |
| 35 | + coverage map, and every required tandem PR (OSS e2e / Enterprise / Enterprise |
| 36 | + e2e-python) is present, linked, and running its suite. |
| 37 | + |
| 38 | +If any such finding is still open — including a required-but-missing tandem PR — |
| 39 | +do NOT approve. Tell the user the PR does not meet the bar and suggest |
| 40 | +`reject-pr`. |
| 41 | + |
| 42 | +- If no review report exists in this conversation, STOP and tell the user to run |
| 43 | + `/skill:review-pr` first — do not approve unreviewed code. |
| 44 | +- Post the review verbatim; do not shorten or rewrite it. |
| 45 | + |
| 46 | +## Step 1: Detect the PR |
| 47 | + |
| 48 | +Auto-detect the PR from the checked-out branch. An explicit PR number/URL in the |
| 49 | +arguments overrides detection. |
| 50 | + |
| 51 | +```bash |
| 52 | +PR='<explicit PR number/URL from arguments, else empty>' |
| 53 | +[ -z "$PR" ] && PR=$(gh pr view --json number -q .number 2>/dev/null) |
| 54 | +if [ -z "$PR" ]; then |
| 55 | + echo "No PR found for the current branch. Run 'gh pr checkout <n>' or pass a PR number."; exit 1 |
| 56 | +fi |
| 57 | +gh pr view "$PR" --json number,title,author,headRefName,url,state,labels |
| 58 | +echo "Approving PR #$PR" |
| 59 | +``` |
| 60 | + |
| 61 | +State one line to the user: which PR (`#number — title`) you are about to approve, |
| 62 | +then proceed. |
| 63 | + |
| 64 | +## Step 2: Write the review body to a file |
| 65 | + |
| 66 | +Write the review body to `/tmp/approve-pr-$PR.md` using the `write` tool (never |
| 67 | +inline it into a shell command — reviews contain backticks, quotes, and `$` that |
| 68 | +break shell quoting). The body is the full verbatim `review-pr` report. |
| 69 | + |
| 70 | +## Step 3: Post the approval |
| 71 | + |
| 72 | +```bash |
| 73 | +gh pr review "$PR" --approve --body-file /tmp/approve-pr-$PR.md |
| 74 | + |
| 75 | +# This repo may not have the label yet — create it idempotently before adding. |
| 76 | +if ! gh label list --limit 200 | grep -qx "QUEUED FOR MERGE"; then |
| 77 | + gh label create "QUEUED FOR MERGE" \ |
| 78 | + --color f5e70d \ |
| 79 | + --description "Approved PR in the merge queue. Do not merge master into this PR." \ |
| 80 | + --force |
| 81 | +fi |
| 82 | +gh pr edit "$PR" --add-label "QUEUED FOR MERGE" |
| 83 | +``` |
| 84 | + |
| 85 | +Notes: |
| 86 | +- GitHub does not allow approving your **own** PR. If `gh pr review --approve` |
| 87 | + fails for that reason, fall back to |
| 88 | + `gh pr comment "$PR" --body-file /tmp/approve-pr-$PR.md`, tell the user the PR |
| 89 | + could not be formally approved because it is self-authored, and still add the |
| 90 | + `QUEUED FOR MERGE` label. |
| 91 | + |
| 92 | +## Step 4: Confirm |
| 93 | + |
| 94 | +Report back in one or two lines: |
| 95 | +- PR number + title, "approved" posted (or the fallback used). |
| 96 | +- Whether the `QUEUED FOR MERGE` label was added (and whether it had to be created). |
| 97 | +- If the review required a tandem PR, remind the user to approve that tandem in its own repo. |
| 98 | +- The PR URL. |
0 commit comments