Skip to content

Commit

Permalink
Option to set PRs to default to Draft (microsoft#4313)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 authored and eslamashour1 committed Dec 30, 2022
1 parent 4d96a30 commit 393495b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
"default": "template",
"description": "%githubPullRequests.pullRequestDescription.description%"
},
"githubPullRequests.createDraft": {
"type": "boolean",
"default": false,
"description": "%githubPullRequests.createDraft%"
},
"githubPullRequests.logLevel": {
"type": "string",
"enum": [
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"githubPullRequests.pullRequestDescription.description": "The description used when creating pull requests.",
"githubPullRequests.pullRequestDescription.template": "Use a pull request template and commit description, or just use the commit description if no templates were found",
"githubPullRequests.pullRequestDescription.commit": "Use the latest commit message only",
"githubPullRequests.createDraft": "Whether the \"Draft\" checkbox will be checked by default when creating a pull request.",
"githubPullRequests.logLevel.description": "Logging for GitHub Pull Request extension. The log is emitted to the output channel named as GitHub Pull Request.",
"githubPullRequests.remotes.markdownDescription": "List of remotes, by name, to fetch pull requests from.",
"githubPullRequests.queries.markdownDescription": "Specifies what queries should be used in the GitHub Pull Requests tree. All queries are made against **the currently opened repos**. Each query object has a `label` that will be shown in the tree and a search `query` using [GitHub search syntax](https://help.github.com/en/articles/understanding-the-search-syntax). The variable `${user}` can be used to specify the logged in user within a search. By default these queries define the categories \"Waiting For My Review\", \"Assigned To Me\" and \"Created By Me\". If you want to preserve these, make sure they are still in the array when you modify the setting.",
Expand Down
1 change: 1 addition & 0 deletions src/common/settingKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const NOTIFICATION_SETTING = 'notifications';
export const POST_CREATE = 'postCreate';
export const QUERIES = 'queries';
export const FOCUSED_MODE = 'focusedMode';
export const CREATE_DRAFT = 'createDraft';

// git
export const GIT = 'git';
Expand Down
5 changes: 3 additions & 2 deletions src/github/createPRViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { GitHubServerType } from '../common/authentication';
import Logger from '../common/logger';
import { Protocol } from '../common/protocol';
import { GitHubRemote } from '../common/remote';
import { ASSIGN_TO, PULL_REQUEST_DESCRIPTION, PUSH_BRANCH } from '../common/settingKeys';
import { ASSIGN_TO, CREATE_DRAFT, PULL_REQUEST_DESCRIPTION, PUSH_BRANCH } from '../common/settingKeys';
import { getNonce, IRequestMessage, WebviewViewBase } from '../common/webview';
import {
byRemoteName,
Expand Down Expand Up @@ -309,7 +309,8 @@ export class CreatePullRequestViewProvider extends WebviewViewBase implements vs
defaultMergeMethod: getDefaultMergeMethod(mergeConfiguration.mergeMethodsAvailability),
allowAutoMerge: mergeConfiguration.viewerCanAutoMerge,
mergeMethodsAvailability: mergeConfiguration.mergeMethodsAvailability,
createError: ''
createError: '',
isDraft: vscode.workspace.getConfiguration(SETTINGS_NAMESPACE).get(CREATE_DRAFT, false)
};

Logger.appendLine(`Initializing "create" view: ${JSON.stringify(params)}`, 'CreatePullRequestViewProvider');
Expand Down

0 comments on commit 393495b

Please sign in to comment.