Check a range of commits by retrieving the log files to be parsed with the expected format for the parser. This change is in part of a larger set of changes making the process for obtaining and parsing commits for release note creation and message validation consistent. This consistency will make it easier to debug as well as ease the design of tooling which is built on top of these processes. PR Close #41341
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
import {Arguments, Argv, CommandModule} from 'yargs';
|
|
|
|
import {addGithubTokenOption} from '../../utils/git/github-yargs';
|
|
|
|
import {mergePullRequest} from './index';
|
|
|
|
/** The options available to the merge command via CLI. */
|
|
export interface MergeCommandOptions {
|
|
githubToken: string;
|
|
pr: number;
|
|
branchPrompt: boolean;
|
|
}
|
|
|
|
/** Builds the command. */
|
|
function builder(yargs: Argv) {
|
|
return addGithubTokenOption(yargs)
|
|
.help()
|
|
.strict()
|
|
.positional('pr', {
|
|
demandOption: true,
|
|
type: 'number',
|
|
description: 'The PR to be merged.',
|
|
})
|
|
.option('branch-prompt' as 'branchPrompt', {
|
|
type: 'boolean',
|
|
default: true,
|
|
description: 'Whether to prompt to confirm the branches a PR will merge into.',
|
|
});
|
|
}
|
|
|
|
/** Handles the command. */
|
|
async function handler({pr, githubToken, branchPrompt}: Arguments<MergeCommandOptions>) {
|
|
await mergePullRequest(pr, githubToken, {branchPrompt});
|
|
}
|
|
|
|
/** yargs command module describing the command. */
|
|
export const MergeCommandModule: CommandModule<{}, MergeCommandOptions> = {
|
|
handler,
|
|
builder,
|
|
command: 'merge <pr>',
|
|
describe: 'Merge a PR into its targeted branches.',
|
|
};
|