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>
This commit was merged in pull request #47.
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
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}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user