Skip to content
Latchkey

Bundle size checks workflow (Choices-js/Choices)

The Bundle size checks workflow from Choices-js/Choices, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: Choices-js/Choices.github/workflows/bundlesize.ymlLicense MITView source

What it does

This is the Bundle size checks workflow from the Choices-js/Choices 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: Bundle size checks

on:
  push:
    branches: [ main ]
    paths:
      - '.github/workflows/bundlesize.yml'
      - 'src/scripts/**'
      - 'src/styles/**'
      - 'package-lock.json'
      - '.browserslistrc'
  pull_request:
    paths:
      - '.github/workflows/bundlesize.yml'
      - 'src/scripts/**'
      - 'src/styles/**'
      - 'package-lock.json'
      - '.browserslistrc'

jobs:
  measure:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - uses: actions/setup-node@v4
        with:
          node-version: 24
          cache: 'npm'

      - name: Install dependencies
        run: npm ci --no-audit

      - run: npm run build

      # we don't need to build here, as even minized assets expected to be commited

      - run: npm run bundlesize
        env:
          # token has expired, don't block the test
          #CI: true
          #BUNDLESIZE_GITHUB_TOKEN: ${{secrets.BUNDLESIZE_GITHUB_TOKEN}}
          CI_REPO_NAME: ${{ github.event.repository.name }}
          CI_REPO_OWNER: ${{ github.event.organization.login }}
          CI_COMMIT_SHA: ${{ github.event.after }}
          GIT_COMMIT: ${{ github.event.after }}
          CI_BRANCH: ${{ github.head_ref }}
          FORCE_COLOR: 2

The same workflow, on Latchkey

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

name: Bundle size checks
 
on:
  push:
    branches: [ main ]
    paths:
      - '.github/workflows/bundlesize.yml'
      - 'src/scripts/**'
      - 'src/styles/**'
      - 'package-lock.json'
      - '.browserslistrc'
  pull_request:
    paths:
      - '.github/workflows/bundlesize.yml'
      - 'src/scripts/**'
      - 'src/styles/**'
      - 'package-lock.json'
      - '.browserslistrc'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  measure:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 1
 
      - uses: actions/setup-node@v4
        with:
          node-version: 24
          cache: 'npm'
 
      - name: Install dependencies
        run: npm ci --no-audit
 
      - run: npm run build
 
      # we don't need to build here, as even minized assets expected to be commited
 
      - run: npm run bundlesize
        env:
          # token has expired, don't block the test
          #CI: true
          #BUNDLESIZE_GITHUB_TOKEN: ${{secrets.BUNDLESIZE_GITHUB_TOKEN}}
          CI_REPO_NAME: ${{ github.event.repository.name }}
          CI_REPO_OWNER: ${{ github.event.organization.login }}
          CI_COMMIT_SHA: ${{ github.event.after }}
          GIT_COMMIT: ${{ github.event.after }}
          CI_BRANCH: ${{ github.head_ref }}
          FORCE_COLOR: 2
 

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

Actions used in this workflow