Skip to content

Commit

Permalink
feat: add option to save resulting pr information into json
Browse files Browse the repository at this point in the history
  • Loading branch information
roivanov committed Oct 15, 2024
1 parent 15c75a9 commit 75e7cfb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/bin/release-please.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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?',
});
Expand Down Expand Up @@ -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);
}
},
Expand Down

0 comments on commit 75e7cfb

Please sign in to comment.