You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-7Lines changed: 23 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ A GitHub Action to [sync OpenAPI specifications with your Fern setup](/learn/api
9
9
10
10
### Case 1: Sync specs from public URL (recommended)
11
11
12
-
1. In your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`.
12
+
1. In your 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
@@ -30,15 +30,18 @@ jobs:
30
30
with:
31
31
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
32
32
- name: Update API with Fern
33
-
uses: fern-api/sync-openapi@v2
33
+
uses: fern-api/sync-openapi@v3
34
34
with:
35
35
update_from_source: true
36
36
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
37
-
branch: 'update-api'
38
37
auto_merge: false # you MUST use auto_merge: true with branch: main
39
38
40
39
```
41
40
41
+
> **PR deduplication**: When `auto_merge` is `false`, the action creates a single PR on the `branch` (default: `fern/sync-openapi`) and accumulates commits on subsequent runs. If the source spec hasn't changed, the action is a no-op. This prevents duplicate PRs from piling up.
42
+
>
43
+
> **Branch divergence handling**: If the PR branch has diverged (e.g., someone manually rebased or edited it), the action will attempt to rebase automatically. If rebase fails due to merge conflicts, a comment is left on the PR with detailed error output and resolution steps.
44
+
42
45
### Case 2: Sync files/folders between repositories
43
46
44
47
1. In your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`.
|`branch`| Branch name to create or update. **Must be a stable name** (e.g., `fern/sync-openapi`) — do not use dynamic/timestamped names, or PR deduplication will not work. | No|`fern/sync-openapi`| 1, 2 |
88
91
|`auto_merge`| If `true`, pushes directly to the branch; if `false`, creates a PR from the branch onto `main`| No |`false`| 1, 2 |
89
92
|`sources`| Array of mappings with `from`, `to`, and optional `exclude` fields | Yes | - | 2 |
90
93
|`repository`| Target repository in format `org/repo`| Yes | - | 2 |
91
-
|`update_from_source`| If `true`, syncs from the source spec files rather than using existing intermediate formats | No |`false`| 1 |
94
+
|`update_from_source`| If `true`, runs `fern api update` on the current repository instead of syncing files between repos| No |`false`| 1 |
92
95
93
96
94
97
**Note: you must set `auto_merge: true` when using `branch: main`**
@@ -107,3 +110,16 @@ The GitHub token used for this action must have:
107
110
3. Name your token (i.e. `OPENAPI_SYNC_TOKEN`) and paste in the PAT token generated above
108
111
4. Replace `<PAT_TOKEN_NAME>` in the example YAML configuration with your token name.
109
112
113
+
## Releasing
114
+
115
+
This project uses GitHub Releases to publish new versions. When a release is published, a workflow automatically updates the major and minor version tags so consumers stay up to date.
116
+
117
+
For example, publishing release `v3.1.0` will:
118
+
- Force-update the `v3` tag (so `@v3` users get the update)
119
+
- Force-update the `v3.1` tag (so `@v3.1` users get the update)
120
+
121
+
To release:
122
+
1. Go to [Releases → Draft a new release](../../releases/new)
123
+
2. Create a new tag (e.g., `v3.1.0`) following [semver](https://semver.org/)
0 commit comments