in scan/src/main.ts [60:115]
async function main(): Promise<void> {
try {
const inputs = getInputs()
await io.mkdirP(inputs.resultsDir)
await io.mkdirP(inputs.cacheDir)
const restoreCachesPromise = restoreCaches(
inputs.cacheDir,
inputs.primaryCacheKey,
inputs.additionalCacheKey,
inputs.useCaches
)
await Promise.all([
putReaction(ANALYSIS_STARTED_REACTION, ANALYSIS_FINISHED_REACTION),
prepareAgent(inputs.args, inputs.useNightly),
restoreCachesPromise
])
const reservedCacheKey = await restoreCachesPromise
const exitCode = (await qodana(inputs)) as QodanaExitCode
const canUploadCache =
isNeedToUploadCache(inputs.useCaches, inputs.cacheDefaultBranchOnly) &&
isExecutionSuccessful(exitCode)
await Promise.all([
pushQuickFixes(inputs.pushFixes, inputs.commitMessage),
uploadArtifacts(
inputs.resultsDir,
inputs.artifactName,
inputs.uploadResult
),
uploadCaches(
inputs.cacheDir,
inputs.primaryCacheKey,
reservedCacheKey,
canUploadCache
),
publishOutput(
exitCode === QodanaExitCode.FailThreshold,
extractArg('-i', '--project-dir', inputs.args),
extractArg('-d', '--source-directory', inputs.args),
inputs.resultsDir,
inputs.useAnnotations,
inputs.postComment,
inputs.prMode,
isExecutionSuccessful(exitCode)
)
])
if (!isExecutionSuccessful(exitCode)) {
setFailed(`qodana scan failed with exit code ${exitCode}`)
} else if (exitCode === QodanaExitCode.FailThreshold) {
setFailed(FAIL_THRESHOLD_OUTPUT)
}
} catch (error) {
setFailed((error as Error).message)
}
}