INNER CODE UNIT · TypeScript
outputs
openai/codex-security · github-action/src/main.ts:31
function outputs(result: ScanResults, target: Target, exitCode: number): void {
const values: Record<string, string | number | boolean> = {
'sarif-path': result.paths.sarifPath, 'json-path': result.paths.jsonPath, 'coverage-path': result.paths.coveragePath,
'results-directory': result.paths.resultsDirectory, 'scan-status': result.scanStatus, 'policy-status': result.policyStatus,
'report-status': result.reportStatus, 'exit-code': exitCode, 'scanned-sha': target.scannedSha,
'analysis-ref': target.analysisRef, 'sarif-upload-ready': result.sarifUploadReady,
'estimated-cost': result.estimatedCost ?? '',
};
for (const [level, count] of Object.entries(result.counts ?? {})) values[`${level}-count`] = count;
for (const [key, value] of Object.entries(values)) core.setOutput(key, String(value));
}
function elapsed(started: number): string {
const seconds = Math.floor((performance.now() - started) / 1000);
return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
}
function heartbeat(label: string, started: number): NodeJS.Timeout {
const timer = setInterval(() => core.info(`${label} is still running; elapsed: ${elapsed(started)}.`), 30_000);
timer.unref();