Skip to content

build: migrate from Lerna to Changesets #1

build: migrate from Lerna to Changesets

build: migrate from Lerna to Changesets #1

Workflow file for this run

name: Changeset
# Verifies that every PR carries a changeset (or an explicit empty one).
# Runs only on pull_request — `push` to main carries already-merged
# changesets that the Release workflow then consumes.
on:
pull_request:
branches: [main]
workflow_dispatch:
inputs:
pr_number:
description: "PR number to test (for fork PRs)"
required: true
type: string
permissions:
contents: read
jobs:
changeset:
name: Changeset present
runs-on: ubuntu-latest
# Skip on the auto-generated "Version Packages" PR (it consumes all changesets).
if: github.head_ref != 'changeset-release/main'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.pr_number && format('refs/pull/{0}/head', inputs.pr_number) || '' }}
# Full history so `changeset status --since=origin/main` can diff.
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 24.x
- name: Install dependencies
run: npm ci
# Fails the PR if no changeset describes the change.
# Add one with `npm run changeset` (or `npm run changeset:empty` for PRs
# that don't need a release entry) and commit it.
# We check `.changesets` (not `.releases`) so that empty changesets
# — which have 0 package bumps but still document the PR — pass.
- name: Verify changeset is present
run: |
npx changeset status --since=origin/main --output=/tmp/cs.json
if [ "$(jq '.changesets | length' /tmp/cs.json)" -eq 0 ]; then
echo "::error::No changeset found on this PR. Run 'npm run changeset' (or 'npm run changeset:empty' for PRs that don't need a release entry) and commit the file."
exit 1
fi