1 name: Validate HTTP Types
2
3 on:
4 pull_request:
5 paths:
6 - "packages/medusa/src/api/**/validators.ts"
7 - "packages/core/types/src/http/**"
8 - "packages/cli/http-types-generator/src/**"
9
10 jobs:
11 validate:
12 name: Validate HTTP Types vs Zod Schemas
13 runs-on: ubuntu-latest
14
15 steps:
16 - name: Checkout
17 uses: actions/checkout@v4
18 with:
19 fetch-depth: 0
20
21 - name: Setup Node.js
22 uses: actions/setup-node@v4
23 with:
24 node-version: "22"
25 cache: "yarn"
26
27 - name: Install dependencies
28 run: yarn install --frozen-lockfile
29
30 - name: Build HTTP types generator
31 run: yarn workspace @medusajs/http-types-generator build
32
33 - name: Get changed validator files
34 id: changed
35 run: |
36 BASE_SHA="${{ github.event.pull_request.base.sha }}"
37 CHANGED=$(git diff --name-only "$BASE_SHA"...HEAD \
38 | grep 'validators\.ts' \
39 | tr '\n' ',' \
40 | sed 's/,$//')
41 echo "files=$CHANGED" >> $GITHUB_OUTPUT
42 if [ -n "$CHANGED" ]; then
43 echo "Changed validator files: $CHANGED"
44 else
45 echo "No changed validator files detected — running full validation"
46 fi
47
48 - name: Validate HTTP types (changed files only)
49 if: steps.changed.outputs.files != ''
50 run: |
51 node packages/cli/http-types-generator/dist/index.js validate \
52 --ci \
53 --changed-files "$CHANGED_FILES"
54 env:
55 CHANGED_FILES: ${{ steps.changed.outputs.files }}
56 MONOREPO_ROOT_PATH: ${{ github.workspace }}
57
58 - name: Validate HTTP types (full)
59 if: steps.changed.outputs.files == ''
60 run: |
61 node packages/cli/http-types-generator/dist/index.js validate --ci
62 env:
63 MONOREPO_ROOT_PATH: ${{ github.workspace }}