diff --git a/dist/index.js b/dist/index.js index 6f84eae..990c01b 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/package.json b/package.json index 991c379..5b35296 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@types/node": "^22.0.0", "expand-tilde": "^2.0.2", "yaml": "^2.3.4", - "zod": "^3.22.4" + "zod": "^4.4.3" }, "devDependencies": { "esbuild": "^0.27.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c3b580b..faa4d10 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,8 +33,8 @@ importers: specifier: ^2.3.4 version: 2.7.0 zod: - specifier: ^3.22.4 - version: 3.24.1 + specifier: ^4.4.3 + version: 4.4.3 devDependencies: esbuild: specifier: ^0.27.4 @@ -493,6 +493,7 @@ packages: uuid@8.3.2: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). hasBin: true webidl-conversions@3.0.1: @@ -514,8 +515,8 @@ packages: engines: {node: '>= 14'} hasBin: true - zod@3.24.1: - resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} + zod@4.4.3: + resolution: {integrity: sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==} snapshots: @@ -993,4 +994,4 @@ snapshots: yaml@2.7.0: {} - zod@3.24.1: {} + zod@4.4.3: {} diff --git a/src/inputs/run-install.ts b/src/inputs/run-install.ts index a30877c..44bb853 100644 --- a/src/inputs/run-install.ts +++ b/src/inputs/run-install.ts @@ -1,6 +1,6 @@ import { getInput, error } from '@actions/core' import { parse as parseYaml } from 'yaml' -import { z, ZodError } from 'zod' +import * as z from 'zod' const RunInstallSchema = z.object({ recursive: z.boolean().optional(), @@ -15,27 +15,22 @@ const RunInstallInputSchema = z.union([ z.array(RunInstallSchema), ]) -export type RunInstallInput = z.infer export type RunInstall = z.infer export function parseRunInstall(inputName: string): RunInstall[] { const input = getInput(inputName, { required: true }) const parsedInput: unknown = parseYaml(input) - try { - const result: RunInstallInput = RunInstallInputSchema.parse(parsedInput) - if (!result) return [] - if (result === true) return [{ recursive: true }] - if (Array.isArray(result)) return result - return [result] - } catch (exception: unknown) { + const result = RunInstallInputSchema.safeParse(parsedInput) + if (!result.success) { error(`Error for input "${inputName}" = ${input}`) - - if (exception instanceof ZodError) { - error(`Errors: ${exception.errors}`) - } else { - error(`Exception: ${exception}`) - } + error(z.prettifyError(result.error)) process.exit(1) } + + const { data } = result + if (!data) return [] + if (data === true) return [{ recursive: true }] + if (Array.isArray(data)) return data + return [data] }