mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-25 15:01:49 +00:00
4a2578d18d
* build(deps): update dependency zod to v4 | datasource | package | from | to | | ---------- | ------- | ------- | ----- | | npm | zod | 3.25.76 | 4.3.6 | * fix: zod migration --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { z } from 'zod/v3';
|
|
import {
|
|
LooseArray,
|
|
LooseRecord,
|
|
Yaml,
|
|
withDebugMessage,
|
|
} from '../../../util/schema-utils/index.ts';
|
|
|
|
const Steps = z.object({
|
|
uses: z.string(),
|
|
with: LooseRecord(
|
|
z.union([z.string(), z.number().transform((s) => s.toString())]),
|
|
),
|
|
});
|
|
export type Steps = z.infer<typeof Steps>;
|
|
|
|
const WorkFlowJobs = z.object({
|
|
jobs: LooseRecord(
|
|
z.object({
|
|
container: z
|
|
.union([
|
|
z.string(),
|
|
z.object({ image: z.string() }).transform((v) => v.image),
|
|
])
|
|
.optional()
|
|
.catch(undefined),
|
|
services: LooseRecord(
|
|
z.union([
|
|
z.object({ image: z.string() }).transform((v) => v.image),
|
|
z.string(),
|
|
]),
|
|
)
|
|
.catch({})
|
|
.transform((services) => Object.values(services)),
|
|
'runs-on': z
|
|
.union([z.string().transform((v) => [v]), z.array(z.string())])
|
|
.catch([]),
|
|
steps: LooseArray(Steps).catch([]),
|
|
}),
|
|
),
|
|
});
|
|
|
|
const Actions = z.object({
|
|
runs: z.object({
|
|
using: z.string(),
|
|
steps: LooseArray(Steps).optional().catch([]),
|
|
}),
|
|
});
|
|
export const Workflow = Yaml.pipe(
|
|
z.union([WorkFlowJobs, Actions, z.null()]),
|
|
).catch(withDebugMessage(null, 'Does not match schema'));
|