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, CommandModule} from 'yargs';
import {addGithubTokenFlag} from '../../utils/yargs';
import {addGithubTokenOption} from '../../utils/git/github-yargs';
import {checkOutPullRequestLocally} from '../common/checkout-pr';
export interface CheckoutOptions {
@ -18,7 +18,7 @@ export interface CheckoutOptions {
/** Builds the checkout pull request command. */
function builder(yargs: Argv) {
return addGithubTokenFlag(yargs).positional('prNumber', {type: 'number', demandOption: true});
return addGithubTokenOption(yargs).positional('prNumber', {type: 'number', demandOption: true});
}
/** Handles the checkout pull request command. */