Skip to content
Latchkey

Health Check workflow (americanexpress/jest-image-snapshot)

The Health Check workflow from americanexpress/jest-image-snapshot, explained and optimized by Latchkey.

C

CI health: C - fair

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: americanexpress/jest-image-snapshot.github/workflows/health-check.ymlLicense Apache-2.0View source

What it does

This is the Health Check workflow from the americanexpress/jest-image-snapshot 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: Health Check

on:
  schedule:
    # At minute 0 past hour 0800 and 2000.
    - cron:  '0 8,20 * * *'

jobs:
  tests:
    strategy:
      matrix:
        node: [ '18.x', '20.x', '22.x' ]
        os: [ ubuntu-latest, windows-latest, macos-latest ]
    runs-on: ${{ matrix.os }}
    name: Node ${{ matrix.node }} - ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v4
    - run: |
        git remote set-branches --add origin main
        git fetch
    - name: Setup Node
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node }}
    - name: Install Dependencies
      run: npm ci
      env:
        NODE_ENV: development
    - name: Run Test Script
      run: npm run test
      env:
        NODE_ENV: production

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: Health Check
 
on:
  schedule:
    # At minute 0 past hour 0800 and 2000.
    - cron:  '0 8,20 * * *'
 
jobs:
  tests:
    timeout-minutes: 30
    strategy:
      matrix:
        node: [ '18.x', '20.x', '22.x' ]
        os: [ ubuntu-latest, windows-latest, macos-latest ]
    runs-on: ${{ matrix.os }}
    name: Node ${{ matrix.node }} - ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v4
    - run: |
        git remote set-branches --add origin main
        git fetch
    - name: Setup Node
      uses: actions/setup-node@v2
      with:
        cache: 'npm'
        node-version: ${{ matrix.node }}
    - name: Install Dependencies
      run: npm ci
      env:
        NODE_ENV: development
    - name: Run Test Script
      run: npm run test
      env:
        NODE_ENV: production
 

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 (9 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