Merge pull request #2919 from gsd-build/fix/2911-audit-open-output-references

fix(#2911): audit-open emits raw human report and parseable JSON
This commit is contained in:
Tom Boucher
2026-04-30 21:23:30 -04:00
committed by GitHub
2 changed files with 126 additions and 3 deletions

View File

@@ -703,12 +703,15 @@ async function runCommand(command, args, cwd, raw, defaultValue) {
case 'audit-open': {
const { auditOpenArtifacts, formatAuditReport } = require('./lib/audit.cjs');
const includeRaw = args.includes('--json');
const wantJson = args.includes('--json');
const result = auditOpenArtifacts(cwd);
if (includeRaw) {
if (wantJson) {
// core.output JSON-stringifies its first arg; pass the object directly.
core.output(result, raw);
} else {
core.output(formatAuditReport(result), raw);
// Human-readable report must bypass JSON encoding — use the rawValue
// form (third arg) which core.output emits verbatim.
core.output(null, true, formatAuditReport(result));
}
break;
}