Generate in CI
Use Typeship in CI: trigger a project's normal pull request, generate into your checkout, or gate a release on spec drift.
A Project watches its Spec and opens destination pull requests with automatic generation on by default. Use CI when your pipeline needs to trigger that workflow, generate a package into its own checkout, or validate a live API response.
The Typeship CLI generates packages and operates Projects. A generated CLI calls your API. Install the Typeship executable on your runner before running the steps below.
Trigger the project's normal pull request
The Typeship CLI reads its key from TYPESHIP_TOKEN and prints JSON, so it drops into any job. Create a key under api keys in the console and store it as a secret.
name: Regenerate SDK
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * 1"
jobs:
regenerate:
runs-on: self-hosted
env:
TYPESHIP_TOKEN: ${{ secrets.TYPESHIP_TOKEN }}
steps:
- name: Regenerate and open destination PRs
run: typeship projects generate prj_your_project_idprojects generate runs the same URL- or repository-sourced pipeline as a Spec change. It records one Generation per Target and the immutable Spec Revision, then opens one pull request per changed destination with the release-style compatibility report and semver check. If the package already matches a destination and no Draft is open, no new commit, branch, or pull request is needed. An existing Draft stays open. Do not unpack and recommit it: that would bypass the Delivery workflow you configured.
Generate ad hoc, no project
packages generate runs the generator on any spec without a Project or signing in. Supply a Spec and one Target descriptor:
typeship packages generate \
--spec '{"url":"https://typeship.dev/examples/petstore/openapi.yaml"}' \
--target '{"type":"typescript_sdk"}' \
--out packages/typescriptOr with curl:
curl -s https://typeship.dev/api/v1/generate \
-H "Content-Type: application/json" \
-d '{"spec":{"url":"https://typeship.dev/examples/petstore/openapi.yaml"},"target":{"type":"python_sdk"}}'Anonymous and Free ad hoc generation covers 25 operations of a spec without retaining spec contents or generated files. An anonymous URL run without source headers may return a seven-day claim link; it does not consume the Free Project slot unless someone claims it. Use it when this checkout's CI owns the commit; use a project when Typeship should maintain history, source watching, compatibility reporting, and destination pull requests.
Smoke-test a live API operation
Generate a CLI Target, build it, then run a read-only operation. The generated CLI reports request failures, but does not compare live responses with the Spec. Add an application-level assertion when your CI job needs to check response fields.
This workflow uses the same public, unauthenticated Petstore API as the Quickstart:
name: Smoke-test API response
on:
workflow_dispatch:
jobs:
smoke-test:
runs-on: self-hosted
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.27"
- name: Generate the CLI
run: >-
typeship packages generate
--spec '{"url":"https://typeship.dev/examples/petstore/openapi.yaml"}'
--target '{"type":"cli"}'
--out packages/petstore-cli
- name: Build the CLI
working-directory: packages/petstore-cli
run: |
go build -o petstore .
- name: Call the live API
run: packages/petstore-cli/petstore pets list --jsonThis step succeeds when the operation returns a successful response; it does not validate response fields or detect Spec drift. For your API, replace the Spec URL, discover a read-only command with --help, and supply the credentials named in its generated README through CI secrets.