# * Runs unit tests on push/PR to main and staging. # * Uses self-hosted runner for push events, GitHub-hosted for PRs (public repo security). name: Test on: push: branches: [main, staging] pull_request: branches: [main, staging] concurrency: group: test-${{ github.ref }} cancel-in-progress: true permissions: contents: read packages: read jobs: test: name: unit-tests runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-latest' || 'self-hosted' }} steps: - uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: 22 cache: npm - name: Install dependencies run: npm ci env: NODE_AUTH_TOKEN: ${{ secrets.PKG_READ_TOKEN }} - name: Run tests run: npm test