refactor(dev-infra): share more github code between commands (#38656)

Instead of repeating the logic for adding the github token to
a repository git url, we add a shared function for automatically
computing the URls with token.

Additionally, URLs for updating/generating tokens have been moved
to a dedicated file in the `utils` folder. Also while being at it,
the yargs github token helper is also moved into the dedicated
Git/Github related util folder.

PR Close #38656
This commit is contained in:
Paul Gschwendtner
2020-09-01 10:39:35 +02:00
committed by Alex Rickabaugh
parent 5bf55132fb
commit 78c9972195
11 changed files with 62 additions and 47 deletions

View File

@ -8,7 +8,7 @@
import {Arguments, Argv} from 'yargs';
import {addGithubTokenFlag} from '../../utils/yargs';
import {addGithubTokenOption} from '../../utils/git/github-yargs';
import {mergePullRequest} from './index';
@ -20,7 +20,7 @@ export interface MergeCommandOptions {
/** Builds the options for the merge command. */
export function buildMergeCommand(yargs: Argv): Argv<MergeCommandOptions> {
return addGithubTokenFlag(yargs).help().strict().positional(
return addGithubTokenOption(yargs).help().strict().positional(
'pr-number', {demandOption: true, type: 'number'});
}