name: _load
on:
  workflow_call:
    inputs:
      site:
        required: true
        type: string
    secrets:
      APP_ID:
        required: true
      APP_PRIVATE_KEY:
        required: true
jobs:
  load:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: npm run api:load
      - uses: actions/setup-node@v3
        if: ${{ !env.ACT }}
        with:
          node-version: 16
          cache: 'npm'
      - run: npm install
      - run: CHANNELS_PATH=sites/${{inputs.site}}/*.channels.xml npm run queue:create -- --max-clusters=1
      - run: NODE_OPTIONS=--insecure-http-parser npm run cluster:load -- --timeout=30000  --cluster-id=1
      - run: npm run programs:save
      - uses: actions/upload-artifact@v3
        with:
          name: database
          path: scripts/database
