Skip to content

Commit 6cf3276

Browse files
docs: update README with PR deduplication, default branch, releasing section; bump to node20
Co-Authored-By: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com>
1 parent 2f70c00 commit 6cf3276

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A GitHub Action to [sync OpenAPI specifications with your Fern setup](/learn/api
99

1010
### Case 1: Sync specs from public URL (recommended)
1111

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/`.
1313
2. Include the following contents in `sync-openapi.yml`:
1414

1515
```yaml
@@ -30,15 +30,18 @@ jobs:
3030
with:
3131
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
3232
- name: Update API with Fern
33-
uses: fern-api/sync-openapi@v2
33+
uses: fern-api/sync-openapi@v3
3434
with:
3535
update_from_source: true
3636
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
37-
branch: 'update-api'
3837
auto_merge: false # you MUST use auto_merge: true with branch: main
3938

4039
```
4140

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+
4245
### Case 2: Sync files/folders between repositories
4346

4447
1. In your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`.
@@ -60,7 +63,7 @@ jobs:
6063
steps:
6164
- uses: actions/checkout@v4
6265
- name: Sync OpenAPI spec to target repo
63-
uses: fern-api/sync-openapi@v2
66+
uses: fern-api/sync-openapi@v3
6467
with:
6568
repository: <your-org>/<your-target-repo>
6669
token: ${{ secrets.<PAT_TOKEN_NAME> }}
@@ -83,12 +86,12 @@ jobs:
8386

8487
| Input | Description | Required | Default | Case |
8588
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------|----------|---------------------------|---------|
86-
| `token` | GitHub token for authentication | No | `${{ github.token }}` | 1, 2 |
87-
| `branch` | Branch to push to in the target repository | Yes | - | 1, 2 |
89+
| `token` | GitHub token for authentication | Yes | - | 1, 2 |
90+
| `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 |
8891
| `auto_merge` | If `true`, pushes directly to the branch; if `false`, creates a PR from the branch onto `main` | No | `false` | 1, 2 |
8992
| `sources` | Array of mappings with `from`, `to`, and optional `exclude` fields | Yes | - | 2 |
9093
| `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 |
9295

9396

9497
**Note: you must set `auto_merge: true` when using `branch: main`**
@@ -107,3 +110,16 @@ The GitHub token used for this action must have:
107110
3. Name your token (i.e. `OPENAPI_SYNC_TOKEN`) and paste in the PAT token generated above
108111
4. Replace `<PAT_TOKEN_NAME>` in the example YAML configuration with your token name.
109112

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/)
124+
3. Click **Publish release**
125+

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ inputs:
2323
required: false
2424
default: 'false'
2525
runs:
26-
using: 'node16'
26+
using: 'node20'
2727
main: 'dist/index.js'
2828
branding:
2929
icon: 'refresh-cw'

0 commit comments

Comments
 (0)