Skip to content
Latchkey

Build Template workflow (e2b-dev/code-interpreter)

The Build Template workflow from e2b-dev/code-interpreter, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: e2b-dev/code-interpreter.github/workflows/build_test_template.ymlLicense Apache-2.0View source

What it does

This is the Build Template workflow from the e2b-dev/code-interpreter repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

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

The workflow

workflow (.yml)
name: Build Template

on:
  workflow_call:
    secrets:
      E2B_API_KEY:
        required: true
    inputs:
      E2B_DOMAIN:
        required: false
        type: string
    outputs:
      template_id:
        description: "The ID of the built template"
        value: ${{ jobs.build.outputs.template_id }}

permissions:
  contents: read

jobs:
  build:
    name: Build E2B Template
    runs-on: ubuntu-latest
    outputs:
      template_id: ${{ steps.build-template.outputs.template_id }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Parse .tool-versions
        uses: wistia/parse-tool-versions@v2.1.1
        with:
          filename: '.tool-versions'
          uppercase: 'true'
          prefix: 'tool_version_'

      - name: Set package version
        working-directory: ./template
        run: |
          VERSION=$(cat ../chart_data_extractor/pyproject.toml | grep version | cut -d '"' -f 2)
          echo "Version: $VERSION"
          sed -i "s/e2b_charts/e2b_charts==${VERSION}/g" requirements.txt

      - uses: actions/setup-python@v6
        with:
          python-version: '${{ env.TOOL_VERSION_PYTHON }}'

      - name: Install development dependencies
        working-directory: ./template
        run: pip install -r requirements-dev.txt

      - name: Generate Template Name
        id: generate-template-id
        run: |
          E2B_TESTS_TEMPLATE=e2b-code-interpreter-ci-$(uuidgen)
          echo "Generated Template Name: $E2B_TESTS_TEMPLATE"
          echo "template_name=$E2B_TESTS_TEMPLATE" >> $GITHUB_OUTPUT

      - name: Build E2B template
        id: build-template
        working-directory: ./template
        run: |
          python build_ci.py
        env:
          E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
          E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}
          E2B_TESTS_TEMPLATE: ${{ steps.generate-template-id.outputs.template_name }}

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Build Template
 
on:
  workflow_call:
    secrets:
      E2B_API_KEY:
        required: true
    inputs:
      E2B_DOMAIN:
        required: false
        type: string
    outputs:
      template_id:
        description: "The ID of the built template"
        value: ${{ jobs.build.outputs.template_id }}
 
permissions:
  contents: read
 
jobs:
  build:
    timeout-minutes: 30
    name: Build E2B Template
    runs-on: latchkey-small
    outputs:
      template_id: ${{ steps.build-template.outputs.template_id }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
 
      - name: Parse .tool-versions
        uses: wistia/parse-tool-versions@v2.1.1
        with:
          filename: '.tool-versions'
          uppercase: 'true'
          prefix: 'tool_version_'
 
      - name: Set package version
        working-directory: ./template
        run: |
          VERSION=$(cat ../chart_data_extractor/pyproject.toml | grep version | cut -d '"' -f 2)
          echo "Version: $VERSION"
          sed -i "s/e2b_charts/e2b_charts==${VERSION}/g" requirements.txt
 
      - uses: actions/setup-python@v6
        with:
          cache: 'pip'
          python-version: '${{ env.TOOL_VERSION_PYTHON }}'
 
      - name: Install development dependencies
        working-directory: ./template
        run: pip install -r requirements-dev.txt
 
      - name: Generate Template Name
        id: generate-template-id
        run: |
          E2B_TESTS_TEMPLATE=e2b-code-interpreter-ci-$(uuidgen)
          echo "Generated Template Name: $E2B_TESTS_TEMPLATE"
          echo "template_name=$E2B_TESTS_TEMPLATE" >> $GITHUB_OUTPUT
 
      - name: Build E2B template
        id: build-template
        working-directory: ./template
        run: |
          python build_ci.py
        env:
          E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
          E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}
          E2B_TESTS_TEMPLATE: ${{ steps.generate-template-id.outputs.template_name }}
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

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 per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow