Skip to content

Commit 04c1f15

Browse files
authored
Merge pull request #4 from devalog/readme-edits
Clarify README use cases
2 parents 59d4ee1 + 92cbd9b commit 04c1f15

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# sync-openapi
22

3-
A GitHub Action to sync files/folders from your source repository to a target repository (like fern-config).
3+
A GitHub Action to sync OpenAPI specifications with your Fern setup. Choose your scenario:
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)
47

58
## Usage
69

7-
### Case 1: Sync files/folders between repositories
10+
### Case 1: Sync specs using `fern api update` (recommended)
811

912
1. In your your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`.
1013
2. Include the following contents in `sync-openapi.yml`:
@@ -20,32 +23,24 @@ on: # additional custom triggers ca
2023
- cron: '0 3 * * *' # everyday at 3:00 AM UTC
2124

2225
jobs:
23-
sync:
26+
update-from-source:
2427
runs-on: ubuntu-latest
2528
steps:
2629
- uses: actions/checkout@v4
27-
- name: Sync OpenAPI spec to target repo
30+
with:
31+
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
32+
- name: Update API with Fern
2833
uses: fern-api/sync-openapi@v2
2934
with:
30-
repository: <your-org>/<your-target-repo>
31-
token: ${{ secrets.<PAT_TOKEN_NAME> }}
32-
sources: # all paths are relative to source repository root
33-
- from: path/to/source/dir # supports folder syncing
34-
to: path/to/target/dir
35-
exclude: # optional
36-
- "path/to/file/to/exclude.yaml" # supports individual file exclusion
37-
- "path/to/dir/to/exclude/**" # supports glob-based pattern matching
38-
- "path/to/files/*_test.yaml"
39-
- from: path/to/source/file.yaml # supports individual file syncing
40-
to: path/to/target/file.yaml
41-
....
42-
43-
branch: main
44-
auto_merge: true # you MUST use auto_merge: true with branch: main
35+
update_from_source: true
36+
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
37+
branch: 'update-api'
38+
auto_merge: false # you MUST use auto_merge: true with branch: main
39+
add_timestamp: true
4540

4641
```
4742

48-
### Case 2: Sync specs using `fern api update`
43+
### Case 2: Sync files/folders between repositories
4944

5045
1. In your your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`.
5146
2. Include the following contents in `sync-openapi.yml`:
@@ -61,25 +56,30 @@ on: # additional custom triggers ca
6156
- cron: '0 3 * * *' # everyday at 3:00 AM UTC
6257

6358
jobs:
64-
update-from-source:
59+
sync:
6560
runs-on: ubuntu-latest
6661
steps:
6762
- uses: actions/checkout@v4
68-
with:
69-
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
70-
- name: Update API with Fern
63+
- name: Sync OpenAPI spec to target repo
7164
uses: fern-api/sync-openapi@v2
7265
with:
73-
update_from_source: true
74-
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
75-
branch: 'update-api'
76-
auto_merge: false # you MUST use auto_merge: true with branch: main
77-
add_timestamp: true
78-
79-
```
80-
66+
repository: <your-org>/<your-target-repo>
67+
token: ${{ secrets.<PAT_TOKEN_NAME> }}
68+
sources: # all paths are relative to source repository root
69+
- from: path/to/source/dir # supports folder syncing
70+
to: path/to/target/dir
71+
exclude: # optional
72+
- "path/to/file/to/exclude.yaml" # supports individual file exclusion
73+
- "path/to/dir/to/exclude/**" # supports glob-based pattern matching
74+
- "path/to/files/*_test.yaml"
75+
- from: path/to/source/file.yaml # supports individual file syncing
76+
to: path/to/target/file.yaml
77+
....
8178

79+
branch: main
80+
auto_merge: true # you MUST use auto_merge: true with branch: main
8281

82+
```
8383
## Inputs
8484

8585
| Input | Description | Required | Default | Case |

0 commit comments

Comments
 (0)