Skip to main content

Automate OpenAPI updates

Automating updates

Stainless aims to make every part of shipping SDKs as painless as possible for developers. Here's how code flows from your repository to your end users.

Updates with previews

If you store your OpenAPI spec in a GitHub repository, and all updates to your OpenAPI spec are made via pull requests, we recommend using our GitHub action to preview changes to your SDK.

After setting up the action, pull requests to your GitHub repository that update the OpenAPI spec will build your SDKs, and make a comment on the pull request with the results.

See the instructions under the Build Stainless SDKs GitHub action.

Push-only updates

Unlike the preview workflow, the push-only workflows directly commit changes to the main branch of your Stainless project. They are simpler, but less powerful.

Option 1: Use GitHub action in a push-based Workflow

If you store your OpenAPI spec in a GitHub repository, you can use our GitHub action to build your SDK when a commit is pushed.

After setting up the action, pushes to your GitHub repository that update the OpenAPI spec will build your SDKs.

See our example workflow under the Build Stainless SDKs GitHub action.

Option 2: Set up URL polling for your project

If you have a stable URL to your OpenAPI spec, you can set up polling in the Stainless dashboard.

  1. In the Stainless dashboard, navigate to your project.
  2. Navigate to Release > Setup OpenAPI spec sync > Fetch URL.
  3. Add the URL to your OpenAPI spec.
  4. Click Fetch Spec.

We will check for changes to this link every hour, and it can be manually triggered on the UI.