Skip to content
Latchkey

CI workflow (jakearchibald/svgomg)

The CI workflow from jakearchibald/svgomg, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get 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: jakearchibald/svgomg.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the jakearchibald/svgomg 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: CI

on:
  push:
    branches:
      - main
      - live
      - "!dependabot/**"
  pull_request:
  workflow_dispatch:

env:
  FORCE_COLOR: 2

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest

    steps:
      - name: Clone repository
        uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "lts/*"
          cache: npm

      - name: Install npm dependencies
        run: npm ci

      - name: Lint
        run: npm run lint

  build:
    name: Build
    runs-on: ubuntu-latest

    steps:
      - name: Clone repository
        uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "lts/*"
          cache: npm

      - name: Install npm dependencies
        run: npm ci

      - name: Build
        run: npm run build

      - name: Upload build files
        uses: actions/upload-artifact@v4
        if: github.repository == 'jakearchibald/svgomg' && github.ref == 'refs/heads/live'
        with:
          name: build
          path: ./build/
          if-no-files-found: error

  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    needs: [lint, build]
    if: github.repository == 'jakearchibald/svgomg' && github.ref == 'refs/heads/live'

    steps:
      - name: Clone repository
        uses: actions/checkout@v4

      - name: Download build files
        uses: actions/download-artifact@v4
        with:
          name: build
          path: ./build

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v4
        with:
          allow_empty_commit: false
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: gh-pages
          publish_dir: ./build

The same workflow, on Latchkey

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

name: CI
 
on:
  push:
    branches:
      - main
      - live
      - "!dependabot/**"
  pull_request:
  workflow_dispatch:
 
env:
  FORCE_COLOR: 2
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  lint:
    timeout-minutes: 30
    name: Lint
    runs-on: latchkey-small
 
    steps:
      - name: Clone repository
        uses: actions/checkout@v4
 
      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "lts/*"
          cache: npm
 
      - name: Install npm dependencies
        run: npm ci
 
      - name: Lint
        run: npm run lint
 
  build:
    timeout-minutes: 30
    name: Build
    runs-on: latchkey-small
 
    steps:
      - name: Clone repository
        uses: actions/checkout@v4
 
      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "lts/*"
          cache: npm
 
      - name: Install npm dependencies
        run: npm ci
 
      - name: Build
        run: npm run build
 
      - name: Upload build files
        uses: actions/upload-artifact@v4
        if: github.repository == 'jakearchibald/svgomg' && github.ref == 'refs/heads/live'
        with:
          name: build
          path: ./build/
          if-no-files-found: error
 
  deploy:
    timeout-minutes: 30
    name: Deploy
    runs-on: latchkey-small
    needs: [lint, build]
    if: github.repository == 'jakearchibald/svgomg' && github.ref == 'refs/heads/live'
 
    steps:
      - name: Clone repository
        uses: actions/checkout@v4
 
      - name: Download build files
        uses: actions/download-artifact@v4
        with:
          name: build
          path: ./build
 
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v4
        with:
          allow_empty_commit: false
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: gh-pages
          publish_dir: ./build
 

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

Actions used in this workflow