diff --git a/src/bin/release-please.ts b/src/bin/release-please.ts index b3240fc69..7a67964c9 100644 --- a/src/bin/release-please.ts +++ b/src/bin/release-please.ts @@ -16,6 +16,7 @@ import {coerceOption} from '../util/coerce-option'; import * as yargs from 'yargs'; +import {writeFile} from 'fs'; import {GitHub, GH_API_URL, GH_GRAPHQL_URL} from '../github'; import {Manifest, ManifestOptions, ROOT_PROJECT_PATH} from '../manifest'; import {ChangelogSection, buildChangelogSections} from '../changelog-notes'; @@ -396,7 +397,10 @@ function manifestOptions(yargs: yargs.Argv): yargs.Argv { default: 'release-please-config.json', describe: 'where can the config file be found in the project?', }) - .option('manifest-file', { + .option('json', { + default: null, + describe: 'save json output to a file', + }) .option('manifest-file', { default: '.release-please-manifest.json', describe: 'where can the manifest file be found in the project?', }); @@ -533,6 +537,13 @@ const createReleasePullRequestCommand: yargs.CommandModule< } } else { const pullRequestNumbers = await manifest.createPullRequests(); + if (argv.json){ + writeFile(argv.json.toString(), JSON.stringify(pullRequestNumbers, null, 2), (err) => { + if (err) { + console.error("Error writing file:", err); + } + }); + } console.log(pullRequestNumbers); } },