Health Check workflow (americanexpress/jest-image-snapshot)
The Health Check workflow from americanexpress/jest-image-snapshot, explained and optimized by Latchkey.
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 →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
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
- Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
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:
- Dependency installs
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.