@devries-cameron20 / composio-1 / commits / 8ff9e73b2
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

test(docs): validate workflow YAML shape

jkomyno committed Aug 25, 2026 at 03:40 UTC 8ff9e73b2b78000c93009953271c1beffe53ec1e
1 file changed +32 -14
docs/tests/static/docs-data-workflow.test.ts
+32 -14
@@ -1,25 +1,43 @@
1 import { describe, expect, test } from 'bun:test';
2 import { readFileSync } from 'node:fs';
3 import { resolve } from 'node:path';
4 +import { z } from 'zod';
5
6 const workflowPath = resolve(process.cwd(), '..', '.github', 'workflows', 'docs-update-data.yml');
7
7 -interface WorkflowStep {
8 - name?: string;
9 - id?: string;
10 - uses?: string;
11 - if?: string;
12 - 'continue-on-error'?: boolean;
13 - 'working-directory'?: string;
14 - env?: Record<string, unknown>;
15 - with?: Record<string, unknown>;
16 - run?: string;
17 -}
8 +const workflowStepSchema = z
9 + .object({
10 + name: z.string().optional(),
11 + id: z.string().optional(),
12 + uses: z.string().optional(),
13 + if: z.string().optional(),
14 + 'continue-on-error': z.boolean().optional(),
15 + 'working-directory': z.string().optional(),
16 + env: z.record(z.string(), z.unknown()).optional(),
17 + with: z.record(z.string(), z.unknown()).optional(),
18 + run: z.string().optional(),
19 + })
20 + .passthrough();
21 +
22 +const workflowSchema = z
23 + .object({
24 + jobs: z
25 + .record(
26 + z.string(),
27 + z
28 + .object({
29 + steps: z.array(workflowStepSchema).optional(),
30 + })
31 + .passthrough()
32 + )
33 + .optional(),
34 + })
35 + .passthrough();
36 +
37 +type WorkflowStep = z.infer<typeof workflowStepSchema>;
38
39 function workflowSteps(path: string, job: string): WorkflowStep[] {
20 - const workflow = Bun.YAML.parse(readFileSync(path, 'utf8')) as {
21 - jobs?: Record<string, { steps?: WorkflowStep[] }>;
22 - };
40 + const workflow = workflowSchema.parse(Bun.YAML.parse(readFileSync(path, 'utf8')));
41 return workflow.jobs?.[job]?.steps ?? [];
42 }
43