30070f7f9c
CD / Release (push) Successful in 33s
Refactoring the action from a composite to Node action. This change improves security through pinning of packages as well as better test-ability and error handling. Reviewed-on: #47 Co-authored-by: Timo Behrendt <t.behrendt@t00n.de> Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
19 lines
496 B
TypeScript
19 lines
496 B
TypeScript
import * as core from "@actions/core";
|
|
import { readFileSync } from "node:fs";
|
|
import { validateJson } from "./validation";
|
|
|
|
export async function run(): Promise<void> {
|
|
try {
|
|
const jsonFilePath = core.getInput("json-file");
|
|
core.info(`Validating JSON file: ${jsonFilePath}`);
|
|
|
|
const json = readFileSync(jsonFilePath, "utf8");
|
|
|
|
await validateJson(json);
|
|
|
|
core.info("JSON file is valid");
|
|
} catch (error) {
|
|
core.setFailed(`Error validating JSON file: ${error}`);
|
|
}
|
|
}
|