Node.js - Build & Auto-Commit to CLI data/report/** workflow (InfuseAI/piperider)
The Node.js - Build & Auto-Commit to CLI data/report/** workflow from InfuseAI/piperider, explained and optimized by Latchkey.
CI health: F - at risk
Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Node.js - Build & Auto-Commit to CLI data/report/** workflow from the InfuseAI/piperider 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: Node.js - Build & Auto-Commit to CLI data/report/**
on:
pull_request:
types:
- closed
# Trigger when PR is closed
paths:
- "static_report/**"
- "piperider_cli/**"
# Trigger when diffs detected in cli and report sources
branches:
- main
# Only PR target is `main`
jobs:
if_merged_build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./static_report
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: Install dependencies
working-directory: ./static_report
run: pnpm install --frozen-lockfile
- name: Build Apps
run: pnpm run build
- name: Pull Remote Changes (before AC)
run: git pull origin main
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: AUTO-COMMIT - build report statics to CLI data/report
branch: ${{ github.base_ref }}
# Auto-commits to target merge branch
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: Node.js - Build & Auto-Commit to CLI data/report/** on: pull_request: types: - closed # Trigger when PR is closed paths: - "static_report/**" - "piperider_cli/**" # Trigger when diffs detected in cli and report sources branches: - main # Only PR target is `main` concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: if_merged_build: timeout-minutes: 30 if: github.event.pull_request.merged == true runs-on: latchkey-small defaults: run: working-directory: ./static_report steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: cache: 'npm' node-version: 16 - uses: pnpm/action-setup@v2.2.2 with: version: 7 - name: Install dependencies working-directory: ./static_report run: pnpm install --frozen-lockfile - name: Build Apps run: pnpm run build - name: Pull Remote Changes (before AC) run: git pull origin main - uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: AUTO-COMMIT - build report statics to CLI data/report branch: ${{ github.base_ref }} # Auto-commits to target merge branch
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. - Cancel superseded runs when a branch or PR gets a newer push.
- 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.
2 third-party actions are referenced by a movable tag. Pin them 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:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.