in scan/src/output.ts [79:139]
export async function publishOutput(
failedByThreshold: boolean,
projectDir: string,
sourceDir: string,
resultsDir: string,
useAnnotations: boolean,
postComment: boolean,
isPrMode: boolean,
execute: boolean
): Promise<void> {
if (!execute) {
return
}
try {
const problems = parseSarif(`${resultsDir}/${QODANA_SARIF_NAME}`)
const reportUrl = getReportURL(resultsDir)
const coverageInfo = getCoverageStats(
getCoverageFromSarif(`${resultsDir}/${QODANA_SHORT_SARIF_NAME}`),
true
)
const licensesInfo: LicenseInfo = getLicenseInfo(resultsDir)
const problemsDescriptions = annotationsToProblemDescriptors(
problems.annotations
)
const toolName = problems.title.split('found by ')[1] ?? QODANA_CHECK_NAME
problems.summary = getSummary(
toolName,
projectDir,
sourceDir,
problemsDescriptions,
coverageInfo,
licensesInfo.packages,
licensesInfo.licenses,
reportUrl,
isPrMode,
DEPENDENCY_CHARS_LIMIT,
VIEW_REPORT_OPTIONS
)
// source dir is needed for project distinction in monorepo
const jobName = `${toolName}` + (sourceDir === '' ? '' : ` (${sourceDir})`)
await Promise.all([
putReaction(ANALYSIS_FINISHED_REACTION, ANALYSIS_STARTED_REACTION),
postResultsToPRComments(
toolName,
problems.summary,
sourceDir,
postComment
),
core.summary.addRaw(problems.summary).write(),
publishAnnotations(jobName, problems, failedByThreshold, useAnnotations)
])
} catch (error) {
core.warning(
`Qodana has problems with publishing results to GitHub – ${
(error as Error).message
}`
)
}
}