vscode-pull-request-github icon indicating copy to clipboard operation
vscode-pull-request-github copied to clipboard

Add "Convert to draft" action in PR reviewers section

Open Copilot opened this issue 2 months ago • 0 comments

Users can mark a draft PR as ready for review but cannot revert it back to draft. This adds symmetry to the workflow.

Changes

GraphQL layer

  • Added ConvertToDraft mutation in queriesShared.gql
  • Added ConvertPullRequestToDraftResponse interface

Model

  • Implemented convertToDraft() method in PullRequestModel with telemetry

UI

  • Added "Convert to draft" button in reviewers section (sidebar)
  • Button shown when PR is not draft AND (user is author OR has write permission)
  • State management handles busy/disabled states during conversion

Message routing

  • Added pr.convertToDraft command handler in pullRequestOverview.ts
  • Added convertToDraft() context method in webview layer

Implementation

Mirrors the existing "Ready for review" pattern:

// Backend
async convertToDraft(): Promise<ConvertToDraft> {
  const { data } = await mutate<ConvertPullRequestToDraftResponse>({
    mutation: schema.ConvertToDraft,
    variables: { input: { pullRequestId: this.graphNodeId } }
  });
  this.item.isDraft = data.convertPullRequestToDraft.pullRequest.isDraft;
  return result;
}

// Frontend component
{!pr.isDraft && (hasWritePermission || pr.isAuthor) && (
  <ConvertToDraft />
)}
Original prompt

This section details on the original issue you should resolve

<issue_title>Support "Convert to draft" in PR view</issue_title> <issue_description>I created a PR and then realized it wasn't ready. It would be great if I could convert the PR to draft from vscode.

Especially since we can mark a PR ready for review:

Image

(not a very important FR, of course)</issue_description>

<agent_instructions>Add a "convert to draft" in the "reviewers" section of the PR webview.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

  • Fixes microsoft/vscode-pull-request-github#6028

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Dec 10 '25 11:12 Copilot