BBC2-25 add bb pr ready#24
Open
b2l wants to merge 1 commit into
Open
Conversation
Marks a draft PR as ready for review via PUT /pullrequests/{id} with
body { draft: false }. Defaults to the PR for the current branch.
Reuses the updatePullRequest helper from BBC2-23. Adds `draft?: boolean`
to UpdatePullRequestInput and exposes `PullRequest.draft` so the command
can pre-flight a GET and:
1. Refuse cleanly on MERGED / DECLINED / SUPERSEDED (API would 4xx).
2. Short-circuit when the PR is already ready — not relying on the API
tolerating a no-op `{draft:false}` PUT (the spec is silent on that).
No `--undraft` counterpart: Bitbucket Cloud has no API path from ready
back to draft, so it's deliberately out of scope.
Stacked on BBC2-23 so updatePullRequest lands together; rebase to main
after that PR merges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bb pr ready [id]that flips a draft PR to ready viaPUT /pullrequests/{id}with body{draft: false}. Defaults to the current branch's PR.updatePullRequesthelper introduced in BBC2-23 —draft?: booleanadded toUpdatePullRequestInput.PullRequest.drafton the detail shape (Bitbucket reports draft as a boolean alongsidestate, independent of it).MERGED/DECLINED/SUPERSEDED(the API 4xx's there).{draft:false}on a non-draft PR is a no-op or a 4xx, so we don't trust either way.--undraftreverse. Bitbucket Cloud has no API path for ready → draft; deliberately out of scope per the ticket.Dependency
Stacks on #23 (BBC2-23). The
updatePullRequesthelper it reuses is introduced there. The PR base is set tobbc2-23-pr-edit; rebase tomainafter that PR merges.Test plan
bun test— 171 tests pass (1 new backend test fordraft:falsePUT body; 2 new mapping tests forPullRequest.draft— populated + default-false)bun run lintcleanbunx tsc --noEmitcleanbb pr ready --helpshows correct helpManual test path
Needs BBC2-42 (
--drafton create) to produce a draft PR. Replace<N>with its id.bb pr create --draft -t "draft-smoke" -b "testing bb pr ready".bb pr ready <N>→ expectMarked pull request #<N> as ready for review: <url>. Verify in the Bitbucket web UI that the draft badge is gone.bb pr ready <N>again → expectPull request #<N> is already ready: <url>(no PUT).bb pr ready <N>→ expectPull request #<N> is merged; cannot mark as ready.bb pr ready(no id) flips it.bb --json pr ready <N>emits the full updated PR detail.Closes BBC2-25.