Automate OpenAPI 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.
Automating updates​
There's two ways of giving us your new OpenAPI spec, through a GitHub action or by configuring polling from a persistent url.
Option 1: GitHub Action (recommended)​
From a repository containing your OpenAPI spec, configure our GitHub action to send us updates when your OpenAPI spec changes.
name: Upload OpenAPI spec to Stainless
on:
push:
branches: [main]
workflow_dispatch:
jobs:
stainless:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: stainless-api/upload-openapi-spec-action@main
with:
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
input_path: 'path/to/my-company-openapi.json'
config_path: 'path/to/my-company.stainless.yaml'
project_name: 'my-stainless-project'
More detailed setup instructions are available in the Action's README.
Option 2: Poll from a persistent URL​
For a simpler but less powerful approach, you can grab a persistent link (such as a raw GitHub link) and set up polling on our SDK Studio. To get to the configuration panel, you can navigate to Studio > OpenAPI > Automate > Fetch URL.
We will check for changes to this link every hour, and it can be manually triggered on the UI.