Skip to content

Commit

Permalink
Merge pull request #1177 from danger/output-json
Browse files Browse the repository at this point in the history
Add ability to ouput results as JSON
  • Loading branch information
orta committed Nov 29, 2021
2 parents a2be690 + 9fe7d5e commit d8ac772
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/commands/ci/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const runRunner = async (app: SharedCLI, config?: Partial<RunnerConfig>)
const execConfig: ExecutorOptions = {
stdoutOnly: !platform.supportsCommenting() || app.textOnly,
verbose: app.verbose,
jsonOnly: false,
jsonOnly: app.outputJSON,
dangerID: app.id || "Danger",
passURLForDSL: app.passURLForDSL || false,
disableGitHubChecksSupport: !app.useGithubChecks,
Expand Down
1 change: 1 addition & 0 deletions source/commands/danger-local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ program
.description("Runs danger without PR metadata, useful for git hooks.")
.option("-s, --staging", "Just use staged changes.")
.option("-b, --base [branch_name]", "Use a different base branch")
.option("-j, --outputJSON", "Outputs the resulting JSON to STDOUT")
.allowUnknownOption(true)
setSharedArgs(program).parse(process.argv)

Expand Down
2 changes: 2 additions & 0 deletions source/commands/utils/sharedDangerfileArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export interface SharedCLI extends program.CommanderStatic {
newComment?: boolean
/** Removes all previous comment and create a new one in the end of the list */
removePreviousComments?: boolean
/** Output JSON to STDOUT */
outputJSON: boolean
}

export default (command: any) =>
Expand Down

0 comments on commit d8ac772

Please sign in to comment.