on:
  workflow_call:

jobs:
  typecheck:
    runs-on: ubuntu-22.04

    steps:
      - name: checkout
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
        with:
          fetch-depth: 2

      - name: setup environment
        uses: ./.github/actions/setup
        with:
          actor: typescript-typecheck
          buildLaboratory: true

      - name: get cpu count
        id: cpu-cores
        uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2

      - uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
        with:
          version: 'v3.18.4'

      - name: install helm deps
        run:
          helm plugin install https://github.com/losisin/helm-values-schema-json.git --version 1.8.0

      - name: generate pulumi deps
        run: pnpm --filter hive generate

      - name: typecheck
        run: pnpm run --workspace-concurrency ${{ steps.cpu-cores.outputs.count }} -r typecheck
        env:
          NODE_OPTIONS: '--max-old-space-size=4096'
