Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/commands/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,14 @@
{
"arg": "-a, --personal-access-token <personal-access-token>",
"description": "Personal access token associated with your Azure DevOps token; falls back to azure_devops.access_token in your spk config",
"required": true
"required": true,
"inherit": "azure_devops.access_token"
},
{
"arg": "-o, --org-name <organization-name>",
"description": "Your Azure DevOps organization name; falls back to azure_devops.org in your spk config",
"required": true
"required": true,
"inherit": "azure_devops.org"
},
{
"arg": "--target-branch",
Expand Down
6 changes: 4 additions & 2 deletions src/commands/service/create-revision.decorator.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
{
"arg": "-a, --personal-access-token <personal-access-token>",
"description": "Personal access token associated with your Azure DevOps token; falls back to azure_devops.access_token in your spk config",
"required": true
"required": true,
"inherit": "azure_devops.access_token"
},
{
"arg": "-o, --org-name <organization-name>",
"description": "Your Azure DevOps organization name; falls back to azure_devops.org in your spk config",
"required": true
"required": true,
"inherit": "azure_devops.org"
},
{
"arg": "--target-branch",
Expand Down
16 changes: 3 additions & 13 deletions src/commands/service/create-revision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Bedrock, Config } from "../../config";
import {
build as buildCmd,
exit as exitCmd,
populateInheritValueFromConfig,
validateForRequiredValues,
} from "../../lib/commandBuilder";
import { createPullRequest } from "../../lib/git/azure";
Expand Down Expand Up @@ -125,26 +126,15 @@ export const makePullRequest = async (
};

const populateValues = async (opts: CommandOptions): Promise<CommandValues> => {
const { azure_devops } = Config();
opts.orgName = opts.orgName || azure_devops?.org;
opts.personalAccessToken =
opts.personalAccessToken || azure_devops?.access_token;
populateInheritValueFromConfig(decorator, Config(), opts);

// Default the remote to the git origin
opts.remoteUrl = await getRemoteUrl(opts.remoteUrl);

// default pull request source branch to the current branch
opts.sourceBranch = await getSourceBranch(opts.sourceBranch);

const errors = validateForRequiredValues(decorator, {
orgName: opts.orgName,
personalAccessToken: opts.personalAccessToken,
remoteUrl: opts.remoteUrl,
sourceBranch: opts.sourceBranch,
});
if (errors.length > 0) {
throw Error("missing required values");
}
validateForRequiredValues(decorator, opts, true);

return {
// validateForRequiredValues confirm that sourceBranch has value
Expand Down