Automatically pull your latest OpenAPI spec from a publicly available URL into your fern folder using the sync-openapi GitHub Action. This keeps your committed spec in sync with your live API without manual updates.
Add the origin field to your generators.yml to specify where your OpenAPI spec is hosted:
Create .github/workflows/sync-openapi.yml in your repository. This action uses fern api update to pull the latest version of your OpenAPI spec from the origin field in your generators.yml file.
Generate a fine-grained personal access token with Contents and Pull requests read/write permissions for your repository.
This creates daily pull requests with any API spec updates. To change the frequency, modify the cron schedule (see GitHub’s schedule syntax).
If your OpenAPI spec lives in a different repository (rather than at a public URL), you can sync it to your Fern folder using explicit file mappings. See the sync-openapi GitHub Action README for this and other advanced configurations.