Skip to content
Latchkey

build-pr workflow (arabcoders/ytptube)

The build-pr workflow from arabcoders/ytptube, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, 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: arabcoders/ytptube.github/workflows/build-pr.ymlLicense MITView source

What it does

This is the build-pr workflow from the arabcoders/ytptube 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: build-pr

permissions:
  contents: read

on:
  pull_request:
    branches:
      - master
      - dev
      - testing
    paths-ignore:
      - "**.md"
      - ".github/ISSUE_TEMPLATE/**"

env:
  BUN_VERSION: latest
  NODE_VERSION: 22
  PYTHON_VERSION: "3.13"

jobs:
  test:
    name: Run Tests & Build Validation
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.PYTHON_VERSION }}

      - name: Install uv
        run: pip install uv

      - name: Install Python dependencies
        run: uv sync

      - name: Run Python linting
        run: uv run ruff check app/

      - name: Run Python tests
        run: uv run pytest app/tests/ -v --tb=short

      - name: Cache bun installation
        id: cache-bun
        uses: actions/cache@v4
        with:
          path: ~/.bun/install/cache
          key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
          restore-keys: |
            ${{ runner.os }}-bun-

      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: Install bun
        uses: oven-sh/setup-bun@v2
        with:
          bun-version: ${{ env.BUN_VERSION }}

      - name: Install frontend dependencies
        working-directory: ui
        env:
          NODE_ENV: development
        run: bun install --frozen-lockfile

      - name: Prepare frontend (nuxt prepare)
        working-directory: ui
        env:
          NODE_ENV: development
        run: bun nuxt prepare

      - name: Run frontend linting
        working-directory: ui
        run: bun run lint

      - name: Run frontend type checking
        working-directory: ui
        run: bun run typecheck

      - name: Run frontend tsc
        working-directory: ui
        run: bun run lint:tsc

      - name: Run frontend tests
        working-directory: ui
        run: bun run test:ci

      - name: Build frontend
        working-directory: ui
        run: bun run generate

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Validate Docker build
        uses: docker/build-push-action@v5
        with:
          context: .
          platforms: linux/amd64
          push: false
          cache-from: type=gha,scope=${{ github.workflow }}
          cache-to: type=gha,mode=max,scope=${{ github.workflow }}
          provenance: false

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-pr
 
permissions:
  contents: read
 
on:
  pull_request:
    branches:
      - master
      - dev
      - testing
    paths-ignore:
      - "**.md"
      - ".github/ISSUE_TEMPLATE/**"
 
env:
  BUN_VERSION: latest
  NODE_VERSION: 22
  PYTHON_VERSION: "3.13"
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    name: Run Tests & Build Validation
    runs-on: latchkey-small
    steps:
      - name: Checkout
        uses: actions/checkout@v4
 
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.PYTHON_VERSION }}
 
      - name: Install uv
        run: pip install uv
 
      - name: Install Python dependencies
        run: uv sync
 
      - name: Run Python linting
        run: uv run ruff check app/
 
      - name: Run Python tests
        run: uv run pytest app/tests/ -v --tb=short
 
      - name: Cache bun installation
        id: cache-bun
        uses: actions/cache@v4
        with:
          path: ~/.bun/install/cache
          key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
          restore-keys: |
            ${{ runner.os }}-bun-
 
      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          cache: 'npm'
          node-version: ${{ env.NODE_VERSION }}
 
      - name: Install bun
        uses: oven-sh/setup-bun@v2
        with:
          bun-version: ${{ env.BUN_VERSION }}
 
      - name: Install frontend dependencies
        working-directory: ui
        env:
          NODE_ENV: development
        run: bun install --frozen-lockfile
 
      - name: Prepare frontend (nuxt prepare)
        working-directory: ui
        env:
          NODE_ENV: development
        run: bun nuxt prepare
 
      - name: Run frontend linting
        working-directory: ui
        run: bun run lint
 
      - name: Run frontend type checking
        working-directory: ui
        run: bun run typecheck
 
      - name: Run frontend tsc
        working-directory: ui
        run: bun run lint:tsc
 
      - name: Run frontend tests
        working-directory: ui
        run: bun run test:ci
 
      - name: Build frontend
        working-directory: ui
        run: bun run generate
 
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
 
      - name: Validate Docker build
        uses: docker/build-push-action@v5
        with:
          context: .
          platforms: linux/amd64
          push: false
          cache-from: type=gha,scope=${{ github.workflow }}
          cache-to: type=gha,mode=max,scope=${{ github.workflow }}
          provenance: false
 

What changed

3 third-party actions are referenced by a movable tag. Pin them 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