Skip to content
Reference

GitHub Actions

Reference for kubb-labs/action. Its inputs, outputs, run flow, the Kubb version it runs, and the snapshot comment it writes on pull requests.

kubb-labs/action@v0 publishes a Studio snapshot with kubb studio snapshot, then writes the result on the pull request. Publish Kubb snapshots with GitHub Actions has the workflow and its permissions.

Run flow

yesnoyesnonoyesWorkflow runPull request from a fork?Skip: GitHub hides secretsfrom forksPull request closed?Delete its CI agentConfig file exists?Open a kubb/init-* pullrequest, then stopkubb studio snapshotSet the outputsWrite the pull requestcomment
  • Each pull request reuses one CI agent and one comment. Each branch push reuses one CI agent and writes no comment.
  • When the snapshot fails, the comment shows the error and links the workflow run, and the step fails.

See GitHub Action runs.

Inputs

InputDefaultWhat it does
tokenRequired. The organization CI API key. The action masks it in logs and passes it to the CLI as KUBB_TOKEN.
github-token${{ github.token }}Token that opens the init pull request and writes the comment.
working-directory.Folder that holds the Kubb config and package.json.
configkubb.config.tsConfig file path, relative to working-directory.
package-namename in package.jsonPackage name of the snapshot.
package-versionversion in package.jsonPackage version of the snapshot, such as 0.0.0-pr.${{ github.event.pull_request.number }}.

Outputs

OutputValue
snapshot-idThe id Studio stores the snapshot under
package-nameThe package name
package-versionThe package version
tarball-urlThe URL of the package tarball
integrityThe SHA-512 integrity of the tarball
agent-urlThe Studio URL of the CI agent that holds the snapshot
editor-urlThe read-only Studio editor for the output
files-added, files-changed, files-removedGenerated files added, changed, and removed since the previous snapshot on the pull request. 0 when there is none.

Kubb version

The action runs node_modules/.bin/kubb from working-directory, so the snapshot uses the Kubb version your config and plugins are built against. That install must be Kubb 5.6.2 or later. Without one, the action runs npx with @kubb/cli@^5.16.0, @kubb/studio@^5.16.0, and tsdown@^0.23.1.

Pull request comment

The comment shows the package name and version, an npm i <tarball-url> command, and the generated file changes against the base branch and since the previous snapshot.

The base branch comparison needs a snapshot of the base branch. Run the workflow on pushes to that branch too.

See Pull request comment details.

Environment variables

VariableDefaultWhat it does
KUBB_STUDIO_URLhttps://kubb.studioStudio URL for a self-hosted deployment

Less common cases

GitHub Action runs

These cases apply when the action runs on a pull request.

  • Deleting a closed pull request's agent is best effort. If the delete fails, the action logs a warning. Studio's idle cleanup removes the agent later.
  • When a kubb/init-* pull request is already open, the action stops without opening another.

Pull request comment details

The comment opens with the package name, version, and an npm i <tarball-url> command. Two sections then compare the generated files, each with a collapsed list of up to 50 files:

SectionCompares withWithout a base
Changes against the base branchThe base branch's latest snapshot, from the push trigger. The heading links its commit.Says to run the workflow on pushes to the base branch
Changes since the previous snapshotThe pull request's previous snapshot. The heading links its commit, or shows its date.Reports a first snapshot with its file count

The comment ends with links to download the package and open the editor, the expiry date, and the source commit.