Check package versions workflow (Mintplex-Labs/anything-llm)
The Check package versions workflow from Mintplex-Labs/anything-llm, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Check package versions workflow from the Mintplex-Labs/anything-llm 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
# This GitHub action is for checking the versions of the packages in the project.
# Any package that is present in both the `server` and `collector` package.json file
# is checked to ensure that they are the same version.
name: Check package versions
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "server/package.json"
- "collector/package.json"
jobs:
run-script:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Run verifyPackageVersions.mjs script
run: |
cd extras/scripts
node verifyPackageVersions.mjs
- name: Fail job on error
if: failure()
run: exit 1
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.
# This GitHub action is for checking the versions of the packages in the project. # Any package that is present in both the `server` and `collector` package.json file # is checked to ensure that they are the same version. name: Check package versions concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: pull_request: types: [opened, synchronize, reopened] paths: - "server/package.json" - "collector/package.json" jobs: run-script: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout repository uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v3 with: cache: 'npm' node-version: '18' - name: Run verifyPackageVersions.mjs script run: | cd extras/scripts node verifyPackageVersions.mjs - name: Fail job on error if: failure() run: exit 1
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - 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.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.