SQSCANGHA-115 Migrate sanity checks

This commit is contained in:
Jeremy Davis
2025-09-08 12:20:35 +02:00
committed by Julien HENRY
parent 9db61695c9
commit 6a808e9a20
12 changed files with 27704 additions and 11 deletions

View File

@@ -1 +1,39 @@
console.log("Hi there");
import * as core from "@actions/core";
import {
checkGradleProject,
checkMavenProject,
checkSonarToken,
validateScannerVersion,
} from "./sanity-checks";
function getInputs() {
//FIXME: should not rely on ENV vars
const scannerVersion = process.env.INPUT_SCANNERVERSION; // core.getInput("scannerVersion");
const projectBaseDir = process.env.INPUT_PROJECTBASEDIR; // core.getInput("projectBaseDir") || ".";
console.log("scannerVersion: ", scannerVersion);
return { scannerVersion, projectBaseDir };
}
function runSanityChecks(inputs) {
try {
const { scannerVersion, projectBaseDir } = inputs;
validateScannerVersion(scannerVersion);
checkSonarToken(core);
checkMavenProject(core, projectBaseDir);
checkGradleProject(core, projectBaseDir);
} catch (error) {
core.setFailed(`Sanity checks failed: ${error.message}`);
process.exit(1);
}
}
function run() {
const inputs = getInputs();
runSanityChecks(inputs);
}
run();