pkg-pr-new workflow (changesets/changesets)
The pkg-pr-new workflow from changesets/changesets, explained and optimized by Latchkey.
A
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the pkg-pr-new workflow from the changesets/changesets 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: pkg-pr-new
on:
pull_request:
types: [labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
queue: max
permissions: {}
jobs:
publish:
name: Publish
if: ${{ contains(github.event.pull_request.labels.*.name, 'pkg.pr.new') }}
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/ci-setup
with:
node-version: 26
skip-cache: true # avoid cache poisoning attacks
- name: Build
run: pnpm build
- run:
| # zizmor: ignore[use-trusted-publishing] we're not publishing to npm here
pnpm exec pkg-pr-new publish --pnpm --packageManager=pnpm --commentWithDev --commentWithSha './packages/*'
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: pkg-pr-new on: pull_request: types: [labeled] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false queue: max permissions: {} jobs: publish: timeout-minutes: 30 name: Publish if: ${{ contains(github.event.pull_request.labels.*.name, 'pkg.pr.new') }} runs-on: latchkey-small steps: - name: Check out repo uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: persist-credentials: false - uses: ./.github/actions/ci-setup with: node-version: 26 skip-cache: true # avoid cache poisoning attacks - name: Build run: pnpm build - run: | # zizmor: ignore[use-trusted-publishing] we're not publishing to npm here pnpm exec pkg-pr-new publish --pnpm --packageManager=pnpm --commentWithDev --commentWithSha './packages/*'
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. - 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.