GitHub Actions
Publish an installable Kubb Studio snapshot from GitHub Actions so reviewers can compare generated files against the base branch and previous runs.
Prerequisites
- A repository with a working
kubb.config.ts. Follow Installation if you have not set up Kubb. - A Kubb Studio organization and an organization CI API key.
Store the CI API key as KUBB_TOKEN in an Actions repository secret. Snapshot installation uses a separate registry key. Only expose the CI secret to trusted pipelines.
Configure the workflow
Add this workflow:
name: Kubb snapshot
on:
pull_request:
# A snapshot of main is what pull requests compare with.
push:
branches: [main]
permissions:
contents: write
pull-requests: write
# Runs of one pull request or branch share a Studio agent, so run them one at a time.
concurrency:
group: kubb-snapshot-${{ github.ref }}
cancel-in-progress: true
jobs:
snapshot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: kubb-labs/action@v1
with:
token: ${{ secrets.KUBB_TOKEN }}
pull-requests: write allows snapshot comments. contents: write lets the action open an initialization pull request when the repository has no Kubb config.
Review the pull request comment for generated changes against the base branch and the previous run.
To pass the tarball URL to another step, give the action an id: snapshot, then read $. See the action reference for all inputs, outputs, and runtime behavior.
Review and install the result
Open the snapshot in Studio to review generated changes. Snapshots expire after seven days; schedule a default-branch run if it can go a week without a push.
To consume the generated package, follow Install the snapshot.