on:
  workflow_call:

jobs:
  typecheck:
    runs-on: ubuntu-22.04

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

      - name: setup environment
        uses: ./.github/actions/setup
        with:
          actor: typescript-typecheck
          cacheTurbo: false

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

      - uses: azure/setup-helm@v4.2.0
        with:
          version: 'v3.14.2'

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

      - 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'
