Skip to content
Latchkey

js workflow (braintrustdata/autoevals)

The js workflow from braintrustdata/autoevals, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: braintrustdata/autoevals.github/workflows/js.yamlLicense MITView source

What it does

This is the js workflow from the braintrustdata/autoevals repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: js

on:
  pull_request:
  push:
    branches: [main]

jobs:
  build:
    name: node ${{ matrix.node-version }} / zod ${{ matrix.zod }}
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        node-version: [20.x, 22.x, 24.x]
        # zod is a peerDependency ("^3.25.0 || ^4.0.0"); test both majors.
        zod: ["3", "4"]

    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Setup pnpm
        uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
        with:
          version: 10.33.0
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version: ${{ matrix.node-version }}
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      # The lockfile pins zod 3, so override across the whole tree
      - name: Force zod 4
        if: matrix.zod == '4'
        run: |
          printf '\noverrides:\n  zod: ^4\n' >> pnpm-workspace.yaml
          pnpm install --no-frozen-lockfile
      - name: Verify resolved zod major
        run: node -e "const v=require('zod/package.json').version; console.log('zod', v); if (!v.startsWith('${{ matrix.zod }}.')) { console.error('expected zod ${{ matrix.zod }}.x'); process.exit(1); }"
      - run: pnpm run test
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
          BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
      - run: pnpm run build

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: js
 
on:
  pull_request:
  push:
    branches: [main]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    name: node ${{ matrix.node-version }} / zod ${{ matrix.zod }}
    runs-on: latchkey-small
 
    strategy:
      fail-fast: false
      matrix:
        node-version: [20.x, 22.x, 24.x]
        # zod is a peerDependency ("^3.25.0 || ^4.0.0"); test both majors.
        zod: ["3", "4"]
 
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Setup pnpm
        uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
        with:
          version: 10.33.0
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version: ${{ matrix.node-version }}
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      # The lockfile pins zod 3, so override across the whole tree
      - name: Force zod 4
        if: matrix.zod == '4'
        run: |
          printf '\noverrides:\n  zod: ^4\n' >> pnpm-workspace.yaml
          pnpm install --no-frozen-lockfile
      - name: Verify resolved zod major
        run: node -e "const v=require('zod/package.json').version; console.log('zod', v); if (!v.startsWith('${{ matrix.zod }}.')) { console.error('expected zod ${{ matrix.zod }}.x'); process.exit(1); }"
      - run: pnpm run test
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
          BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
      - run: pnpm run build
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow