|
1 | 1 | # sync-openapi |
2 | 2 |
|
3 | | -A GitHub Action to sync OpenAPI specifications with your Fern setup. Choose your scenario: |
| 3 | +A GitHub Action to [sync OpenAPI specifications with your Fern setup](/learn/api-definitions/openapi/sync-your-open-api-specification). Choose your scenario: |
4 | 4 |
|
5 | | -- **Case 1: Sync from public URL (most common).** Your OpenAPI spec is hosted at a publicly available URL and you want to pull it into your fern folder |
6 | | -- **Case 2: Sync between repositories**: Your OpenAPI spec lives in one repository and you want to sync it to another repository where your fern folder lives (like fern-config) |
| 5 | +- **Case 1: Sync from public URL (most common).** Your OpenAPI spec is hosted at a publicly available URL and you want to pull it into your fern folder. The GitHub Action uses `fern api update` to pull the latest version of your OpenAPI spec from the `origin` field in your `generators.yml` file. |
| 6 | +- **Case 2: Sync between repositories**: Your OpenAPI spec lives in one repository and you want to sync it to another repository where your fern folder lives (like fern-config). The GitHub Action uses explicit file mappings to pull the latest version of your OpenAPI spec. |
7 | 7 |
|
8 | 8 | ## Usage |
9 | 9 |
|
10 | | -### Case 1: Sync specs using `fern api update` (recommended) |
| 10 | +### Case 1: Sync specs from public URL (recommended) |
11 | 11 |
|
12 | | -1. In your your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`. |
| 12 | +1. In your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`. |
13 | 13 | 2. Include the following contents in `sync-openapi.yml`: |
14 | 14 |
|
15 | 15 | ```yaml |
|
42 | 42 |
|
43 | 43 | ### Case 2: Sync files/folders between repositories |
44 | 44 |
|
45 | | -1. In your your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`. |
| 45 | +1. In your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`. |
46 | 46 | 2. Include the following contents in `sync-openapi.yml`: |
47 | 47 |
|
48 | 48 | ```yaml |
|
88 | 88 | | `branch` | Branch to push to in the target repository | Yes | - | 1, 2 | |
89 | 89 | | `auto_merge` | If `true`, pushes directly to the branch; if `false`, creates a PR from the branch onto `main` | No | `false` | 1, 2 | |
90 | 90 | | `add_timestamp` | If `true`, appends a timestamp to the branch name | No | `true` | 1, 2 | |
91 | | -| `sources` | Array of mappings with `from`, `to`, and optional `exclude` fields | Yes | - | 1 | |
92 | | -| `repository` | Target repository in format `org/repo` | Yes | - | 1 | |
93 | | -| `update_from_source`| If `true`, syncs from the source spec files rather than using existing intermediate formats | No | `false` | 2 | |
| 91 | +| `sources` | Array of mappings with `from`, `to`, and optional `exclude` fields | Yes | - | 2 | |
| 92 | +| `repository` | Target repository in format `org/repo` | Yes | - | 2 | |
| 93 | +| `update_from_source`| If `true`, syncs from the source spec files rather than using existing intermediate formats | No | `false` | 1 | |
94 | 94 |
|
95 | 95 |
|
96 | 96 | **Note: you must set `auto_merge: true` when using `branch: main`** |
|
0 commit comments