A GitHub Action that automates changeset-based releases with branch-specific configurations, similar to semantic-release. Automatically generates changesets from conventional commits, handles pre-release channels, and publishes to npm.
While we love automation, changesets traditionally follow a more manual approach to package versioning. Semantic-release is renowned for its powerful automation capabilities, but it has one significant limitation: it doesn't support monorepos well out of the box.
There are packages like semantic-release-monorepo that add monorepo support, but they all miss one crucial feature - package dependency awareness. This means they can't properly handle version bumps when packages depend on each other within the same monorepo.
With this action, you get the best of both worlds:
- The dependency-aware versioning that changesets provides for monorepos
- The automated publishing workflow that semantic-release offers
- Conventional commit detection that automatically generates changesets
- Seamless integration that auto-merges changes back to your repository
This bridges the gap between manual changeset management and fully automated releases, giving you powerful automation without sacrificing the intelligent dependency handling that makes changesets so valuable for monorepo projects.
- π Automatic changeset generation from conventional commit messages
- πΏ Branch-based release configurations (main, next, beta, etc.)
- π¦ Pre-release support with custom tags (rc, beta, alpha, etc.)
- π Automatic versioning and publishing to npm
- π€ Configurable bot name for commits
name: Release
on:
push:
branches: [main, next]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Release
uses: pixpilot/changesets-autopilot@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}| Input | Description | Required | Default |
|---|---|---|---|
GITHUB_TOKEN |
GitHub token for authentication | β | - |
NPM_TOKEN |
NPM token for publishing (optional when using npm Trusted Publisher / OIDC) | β | - |
provenance |
Enable npm provenance attestation | β | false |
BOT_NAME |
Bot name for commits | β | changesets-autopilot |
BRANCHES |
Branch configuration (YAML array) | β | Auto-detected (see below) |
CREATE_RELEASE |
Enable or disable GitHub release creation | β | true |
PUSH_TAGS |
Enable or disable pushing tags to GitHub (disabling this will also prevent releases) | β | true |
AUTO_CHANGESET |
Enable or disable automatic changeset generation and versioning | β | true |
Default branch behavior:
- If
BRANCHESis provided, that value is used as-is. - If
BRANCHESis not provided and.changeset/config.jsonhasbaseBranch, the action uses:
- <baseBranch>
- name: next
prerelease: rc
channel: next- If
BRANCHESis not provided andbaseBranchis missing, the action falls back to:
- main
- master
- name: next
prerelease: rc
channel: next- name: Release
uses: pixpilot/changeset-autopilot@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
BRANCHES: |
- main
- name: next
prerelease: rc
channel: next
- name: beta
prerelease: beta
channel: betaThis configuration will:
- Release stable versions from
mainbranch (e.g.,1.5.0) - Release RC versions from
nextbranch (e.g.,1.6.0-rc.1) withnexttag - Release beta versions from
betabranch (e.g.,1.6.0-beta.1) withbetatag
You can publish to npm without storing NPM_TOKEN by using npm Trusted Publisher with GitHub OIDC.
Required workflow permissions:
permissions:
contents: write
id-token: writeOIDC workflow example (no NPM_TOKEN):
name: Release
on:
push:
branches: [main, next]
permissions:
contents: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- name: Release
uses: pixpilot/changesets-autopilot@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
provenance: 'true'Backward-compatible token workflow example:
name: Release
on:
push:
branches: [main, next]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- name: Release
uses: pixpilot/changesets-autopilot@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
provenance: 'true'The provenance input is an explicit feature flag. It is independent from how you authenticate to npm.
provenance: 'true'enables npm provenance attestationprovenance: 'false'disables provenance attestation- You can combine it with either
NPM_TOKENor npm Trusted Publisher (OIDC)
If you want npm provenance in your release workflow, set:
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
provenance: 'true'If you are using OIDC Trusted Publisher, keep the required permissions from the OIDC section and add provenance: 'true' in the action inputs.
- Configure npm Trusted Publisher for your package/repository in npm settings.
- Add
permissions.id-token: writeto your release workflow. - Remove
NPM_TOKENfrom workflow inputs and secrets. - Keep
GITHUB_TOKENas-is.
The action will automatically choose auth mode:
- With
NPM_TOKEN: token mode - Without
NPM_TOKEN: OIDC trusted publisher mode
The action will only enable provenance when you explicitly set provenance: 'true'.
This action uses Conventional Commits to determine version bumps:
feat!: redesign user interfacefix(api)!: change response formatBREAKING CHANGE:in commit body/footer
feat: add user dashboardfeat(auth): implement OAuth2
fix: resolve login bugperf: optimize queriesrevert: undo changes
docs:,test:,chore:,ci:,build:,style:,refactor:(without!)
- Detects branch and matches against configuration
- Analyzes commits since last release using conventional commit format
- Generates changesets automatically
- Manages pre-release mode based on branch settings
- Versions packages using changeset tooling
- Publishes to npm with appropriate dist-tags
- Install @changesets/cli as a dev dependency:
npm install --save-dev @changesets/cli
- Changesets initialized in your repository (
npx @changesets/cli init) - NPM registry access for publishing (via
NPM_TOKENor npm Trusted Publisher)
To avoid issues when creating pre-release branches (e.g., for rc, beta, or next releases):
- Always pull the latest changes from the main branch first.
- Create your pre-release branch from the updated main branch.
- This ensures your branch is up-to-date and prevents merge conflicts or outdated changesets.
Recommended workflow:
# Update local main branch
git checkout main
git pull origin main
# Create a new pre-release branch from main
git checkout -b nextIf you encounter issues with publishing or versioning, double-check that your branch is based on the latest main and that all changesets are up-to-date.
Problem: When pushing multiple commits rapidly or triggering multiple workflow runs in quick succession, you may encounter errors like:
Package is not being published because version X.X.X is already published on npm
Why this happens: The action determines the next version by checking the last release details from the repository. If multiple workflow runs execute simultaneously or in quick succession, they may both read the same "last release" state before either has completed publishing and pushed the updated version tags back to the repository. This causes both runs to attempt publishing the same version number.
Workarounds:
- Wait for completion: Ensure each workflow run completes fully before pushing new commits.
- Use concurrency controls: Add concurrency settings to your workflow to prevent parallel runs:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false- Manual intervention: If a duplicate version error occurs, the subsequent run should detect the published version and proceed with the correct next version.
Note: This is a known timing issue that occurs when the repository state hasn't been updated before a new workflow begins. Future versions may include better synchronization mechanisms. In the meantime, using concurrency controls and ensuring sequential workflow runs can help mitigate this issue.
MIT License - see LICENSE file for details.