Files
validate-json-by-json-schem…/src/main.ts
T
t.behrendt 30070f7f9c
CD / Release (push) Successful in 33s
refactor: to node action (#47)
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>
2026-06-27 14:00:15 +02:00

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}`);
}
}