UNPKG

@google-cloud/release-brancher

Version:
72 lines 2.73 kB
"use strict"; // Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. Object.defineProperty(exports, "__esModule", { value: true }); exports.createPullRequestCommand = void 0; const release_brancher_1 = require("../../release-brancher"); exports.createPullRequestCommand = { command: 'create-pull-request', describe: 'create a new release branch and send pull request to add release configuration', builder(yargs) { return yargs .option('branch-name', { describe: 'name of new branch to create', type: 'string', demand: true, }) .option('target-tag', { describe: 'target tag', type: 'string', demand: true, }) .option('release-type', { describe: 'release-please releaseType', type: 'string', }) .option('github-token', { describe: 'GitHub access token', type: 'string', // yargs types do not correctly handle a default option function default: function fromEnvironment() { return process.env.GITHUB_TOKEN || process.env.GH_TOKEN; }, demand: true, }) .option('repo', { describe: 'target repository', type: 'string', demand: true, }) .option('pull-request-title', { describe: 'commit message and the title of the pull request against default branch', type: 'string', }); }, async handler(argv) { const [owner, repo] = argv.repo.split('/'); const runner = new release_brancher_1.Runner({ releaseType: argv['release-type'], upstreamRepo: repo, upstreamOwner: owner, branchName: argv['branch-name'], targetTag: argv['target-tag'], gitHubToken: argv['github-token'], pullRequestTitle: argv['pull-request-title'], }); await runner.createBranch(); await runner.createPullRequest(); await runner.createWorkflowPullRequest(); }, }; //# sourceMappingURL=create-pull-request.js.map